Hamiltonian Paths and Next Neighbor Algorithm in Complete Graphs

100 Views Asked by At

In a complete graph, can the next neighbor algorithm (NNA) ever produce the most optimal Hamiltonian path? The NNA is close enough to the most optimal path to be used in real-life applications, but is there ever an instance in which it happens to also be the most optimal path?

1

There are 1 best solutions below

0
On

Consider $K_4$ with edge weights as given in the following figure.

enter image description here

The optimal Hamiltonian path is given by the following subgraph

enter image description here

Then the nearest neighbor algorithm can indeed find this optimal Hamiltonian path, but since the choice of the start vertex depends on random choice, we have no guarantee. If we start at $3$, then the algorithm will visit $2$, then $4$ and then $1$. However, if we start at $1$, it will proceed to $2$, then to $4$ and then to $3$.