# The Traveling Salesman Problem 3: Nearest Neighbor Heuristic

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

Because of its simplicity, the nearest neighbor heuristic is one of the first algorithms that comes to mind in attempting to solve the traveling salesman problem (TSP), in which a salesman has to plan a tour of cities that is of minimal length. In this heuristic, the salesman starts at some city and then visits the city nearest to the starting city, and so on, only taking care not to visit a city twice. At the end all cities are visited and the salesman returns to the starting city.

[more]
Contributed by: Jaime Rangel-Mondragon (July 2012)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

Reference

[1] E. L. Lawler, J. K. Lenstra, A. H. G. Rinnooy Kan, and D. B. Shmoys, eds., *The Traveling Salesman Problem: A Guided Tour of Combinatorial Optimization*, New York: John Wiley & Sons, 1985.

## Permanent Citation

"The Traveling Salesman Problem 3: Nearest Neighbor Heuristic"

http://demonstrations.wolfram.com/TheTravelingSalesmanProblem3NearestNeighborHeuristic/

Wolfram Demonstrations Project

Published: July 30 2012