TOPICS
Search

Traveling Salesman Problem


TravelingSalesmanProblem

The traveling salesman problem is a problem in graph theory requiring the most efficient (i.e., least total distance) Hamiltonian cycle a salesman can take through each of n cities. The problem is NP-hard, and no exact algorithm running in polynomial time is known. The Held-Karp algorithm solves finite instances exactly using dynamic programming in O(n^22^n) time, where O denotes big-O notation.

Heuristics trade the guarantee of a shortest tour for speed. The nearest neighbor algorithm is a greedy algorithm that repeatedly visits the closest unvisited city and finally returns to its starting city. It constructs a tour in O(n^2) distance comparisons, but can return a tour longer than the optimum. For symmetric distances satisfying the triangle inequality, its worst-case tour-length ratio grows logarithmically with n (Rosenkrantz et al. 1977). Trying different starting cities can improve the result without certifying that it is optimal. Other heuristics, such as the ant colony algorithm, search for good tours rather than guaranteeing the shortest one.

The Wolfram Language command FindShortestTour[g] attempts to find a shortest tour, which is a Hamiltonian cycle (with initial vertex repeated at the end) for a Hamiltonian graph G if it returns a list with first element equal to the vertex count of G.

The traveling salesman problem is mentioned by the character Larry Fleinhardt in the Season 2 episode "Rampage" (2006) of the television crime drama NUMB3RS.

In the Dantzig-Fulkerson-Johnson integer programming formulation, degree constraints enforce a spanning collection of cycles, while subtour elimination constraints exclude disconnected collections. Vercesi and Buchanan (2026) construct instances for which exponentially many of the latter constraints are necessary merely to obtain the optimal tour cost, even with the integrality constraints retained. For asymmetric instances on n vertices, some families require Omega(phi^n) constraints, and symmetric metric instances require Omega(phi^(n/2)), where phi is the golden ratio. There are also planar Euclidean, taxicab, and maximum-metric instances on n=5k vertices requiring at least 2^(n/5) constraints; in the last two metrics k may be any even integer at least 8, with coordinates and distances integer and linear in n.

The lower bounds concern the smallest sufficient subset of these particular subtour constraints; they do not rule out more efficient alternative inequalities or formulations. They also do not assert a general running-time lower bound for TSP algorithms. For one of the symmetric {1,2,3}-weighted families, the optimal tour cost is 3n/2+1 and the full subtour linear relaxation has value 3n/2, so the integrality ratio tends to 1 despite the exponentially many necessary constraints. The authors report developing and refining the constructions with Claude; they wrote the statements and proofs themselves.

The asymmetric traveling salesman problem permits different costs in opposite directions. Hajiaghayi and Yun (2026) give a common constant-factor approximation guarantee for its tour and prescribed-endpoint path versions, measured against their respective subtour linear programming relaxations.


See also

Ant Colony Algorithm, Asymmetric Traveling Salesman Problem, Chinese Postman Problem, Dendrite, Dynamic Programming, Hamiltonian Cycle, Held-Karp Algorithm, Longest Path, Nearest Neighbor Algorithm, Plateau's Problem, Road Coloring Problem, Traveling Salesman Constants

Explore with Wolfram|Alpha

References

Applegate, D.; Bixby, R.; Chvatal, V.; and Cook, W. "Finding Cuts in the TSP (a Preliminary Report)." Technical Report 95-05, DIMACS. Piscataway, NJ: Rutgers University, 1995.Applegate, D.; Bixby, R.; Chvatal, V.; and Cook, W. "Solving Traveling Salesman Problems." http://www.tsp.gatech.edu/.Hajiaghayi, M. and Yun, C. "A Common Improved Bound for Asymmetric TSP and Path TSP." 13 Nov 2026. https://arxiv.org/abs/2611.18498.Hoffman, P. The Man Who Loved Only Numbers: The Story of Paul Erdős and the Search for Mathematical Truth. New York: Hyperion, pp. 168-169, 1998.Kruskal, J. B. "On the Shortest Spanning Subtree of a Graph and the Traveling Salesman Problem." Proc. Amer. Math. Soc. 7, 48-50, 1956.Lawler, E.; Lenstra, J.; Rinnooy Kan, A.; and Shmoys, D. The Traveling Salesman Problem: A Guided Tour of Combinatorial Optimization. New York: Wiley, 1985.Lin, S. "Computer Solutions of the Traveling Salesman Problem." Bell System Tech. J. 44, 2245-2269, 1965.Platzman, L. K. and Bartholdi, J. J. "Spacefilling Curves and the Planar Travelling Salesman Problem." J. Assoc. Comput. Mach. 46, 719-737, 1989.Reinelt, G. "TSPLIB--A Traveling Salesman Problem Library." ORSA J. Comput. 3, 376-384, 1991.Rosenkrantz, D. J.; Stearns, R. E.; and Lewis, P. M., II. "An Analysis of Several Heuristics for the Traveling Salesman Problem." SIAM J. Comput. 6, 563-581, 1977. https://doi.org/10.1137/0206041.Skiena, S. "Traveling Salesman Tours." §5.3.5 in Implementing Discrete Mathematics: Combinatorics and Graph Theory with Mathematica. Reading, MA: Addison-Wesley, pp. 199-202, 1990.Skiena, S. S. "Traveling Salesman Problem." §8.5.4 in The Algorithm Design Manual. New York: Springer-Verlag, pp. 319-322, 1997.Steinhaus, H. Mathematical Snapshots, 3rd ed. New York: Dover, pp. 120-121, 1999.Vercesi, E. and Buchanan, A. "TSP Instances That Require Exponentially Many Subtour Elimination Constraints." 11 Nov 2026. https://arxiv.org/abs/2611.17386.

Referenced on Wolfram|Alpha

Traveling Salesman Problem

Cite this as:

Weisstein, Eric W. "Traveling Salesman Problem." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/TravelingSalesmanProblem.html

Subject classifications