What is the nearest neighbor algorithm?


Quick Answer

The nearest neighbor algorithm is one of the initial approximate algorithms used in finding a possible solution to the travelling salesman problem. Though it shortens the tour, it is a sub-optimal solution.

Continue Reading
What is the nearest neighbor algorithm?
Credit: ZenShui/Eric Audras PhotoAlto Agency RF Collections Getty Images

Full Answer

There are several steps to follow when applying the nearest neighbour algorithm to the problem. First, one has to choose an arbitrary vertex as the current vertex. Then, the shortest edge that connects an unvisited node to the current vertex should be determined. This unvisited point should then be set as the current vertex and marked as visited. If, after this, all the vertices in selected domain are visited, one should terminate the process. If not, then one should execute the second step again. Practical areas where this algorithm has been successfully used include coding satellite images, analysing handwritten digits and solving regression problems.

Learn more about Statistics

Related Questions