pequalsnp
P vs NP: Unsolved. Checked 26 Nov 2026. See the status

The travelling salesman problem

The travelling salesman problem (TSP) asks for the shortest round trip that visits every city in a list exactly once and returns to the start. Its decision version is NP-complete and its optimization version is NP-hard, so no polynomial-time algorithm is known. Even so, exact solvers have proved optimal tours through tens of thousands of cities, and fast heuristics find near-optimal tours for far larger instances.

TSP (also spelled "traveling salesman problem" in American English) is probably the best-known NP-hard problem, and it shows clearly how far practice can go while the theory stays open. A polynomial-time exact algorithm would settle P vs NP; see the current status of P vs NP.

The problem, and its two versions

An instance is a set of n cities and the distance between every pair. A tour visits each city once and returns home. In the symmetric TSP, the distance from A to B equals the distance from B to A. In metric TSP, distances also obey the triangle inequality: going directly is never longer than going through a third city. Road and straight-line distances are typical examples.

There are two ways to ask the question:

  • Optimization version: find the shortest tour.
  • Decision version: given a number k, is there a tour of length at most k?

The decision version is in NP because a proposed tour is easy to check: add up n distances and compare with k. It is also NP-hard, since Hamiltonian circuit, one of Karp's 21 NP-complete problems from 1972, reduces to it. So the decision version is NP-complete. The optimization version is NP-hard but, as a search for a shortest tour rather than a yes/no question, it is not itself in NP. The distinction is covered in NP-complete vs NP-hard.

Why brute force explodes

Fix the starting city. The remaining n - 1 cities can be visited in (n - 1)! orders, and in the symmetric case each tour is counted twice (once per direction). That leaves (n - 1)!/2 distinct tours.

Cities (n) Distinct tours, (n - 1)!/2
5 12
10 181,440
15 about 4.4 × 10^10
20 about 6.1 × 10^16
30 about 4.4 × 10^30

Checking a billion tours per second, 20 cities would take roughly two years, and 30 cities would take far longer than the age of the universe. Exhaustive search is only practical for toy instances.

Held-Karp: exact, but still exponential

In 1962 Richard Bellman, and independently Michael Held and Richard Karp, gave a dynamic programming algorithm. For every subset S of cities and every city j in S, it computes the length of the shortest path that starts at city 1, visits exactly the cities in S, and ends at j. Each entry is built from entries for subsets one city smaller.

There are about n · 2^n such entries, and each takes O(n) work, so the algorithm runs in O(n^2 · 2^n) time and O(n · 2^n) memory. For 30 cities that is about 10^12 basic steps instead of 10^30 tours, a huge gain. It is still exponential. More than 60 years later, whether general TSP can be solved in O((2 - ε)^n) time for some ε > 0 is an open problem.

Approximation: Christofides and the 2020 improvement

An approximation algorithm runs in polynomial time and guarantees a tour within a fixed factor of optimal.

For general TSP with arbitrary distances, no constant factor is possible unless P = NP: a good approximation would let you detect Hamiltonian cycles. With the triangle inequality, things improve. The Christofides algorithm (1976) builds a minimum spanning tree, adds a minimum-weight perfect matching on the tree's odd-degree vertices, and shortcuts the resulting Euler tour. The result is never more than 1.5 times the optimum. Anatoliy Serdyukov found the same algorithm independently in the Soviet Union, published in 1978, so it is sometimes called Christofides-Serdyukov.

For more than four decades nobody beat 1.5 for general metric TSP. In 2020 Anna Karlin, Nathan Klein and Shayan Oveis Gharan posted a randomized algorithm with expected approximation ratio 3/2 - ε, for a fixed ε larger than 10^-36. The improvement is tiny in practice but important in theory, because it showed the 1.5 barrier was not fundamental. The paper appeared at STOC 2021 and in Operations Research in 2024.

There are limits in the other direction too. Karpinski, Lampis and Schmied showed that approximating metric TSP within any factor below 123/122 is NP-hard. So a polynomial-time algorithm guaranteed to come that close to optimal on every metric instance would imply P = NP.

Practical solvers and record instances

The leading exact solver is Concorde, developed by David Applegate, Robert Bixby, Vašek Chvátal and William Cook. It uses branch and cut: solve a linear programming relaxation, add cutting planes that remove fractional solutions, and branch when the cuts stall. The output is not just a tour but a proof that no shorter tour exists.

Concorde has solved all 110 instances in the TSPLIB benchmark library. The largest is pla85900, an 85,900-city instance from a VLSI chip-design application at Bell Labs, solved in 2006 after computation totaling more than 136 CPU-years.

In 2025 William Cook and Sang-il Oum proved optimal a walking tour through 81,998 bars in South Korea, using walking times between every pair of stops. Their computation page reports about 44 CPU-years of work. Successes like these say nothing about the worst case: branch and cut can still take exponential time on some inputs.

Heuristics: good tours fast

When a provably optimal tour is not required, heuristics do very well:

  • Nearest neighbour: start somewhere and always move to the closest unvisited city. Fast and simple, but with no constant-factor guarantee; it is mostly used to build a starting tour.
  • 2-opt: repeatedly remove two edges and reconnect the tour the other way if that makes it shorter, until no such move helps.
  • Lin-Kernighan (Shen Lin and Brian Kernighan, 1973): a variable-depth generalization that chains together several edge exchanges per step. Implementations such as Keld Helsgaun's LKH are the standard for near-optimal tours on large instances.
Approach Guarantee Running time Typical use
Brute force Optimal (n - 1)!/2 tours Toy instances
Held-Karp Optimal O(n^2 · 2^n) Small n, teaching
Branch and cut (Concorde) Optimal, with proof Exponential worst case Record exact solutions
Christofides-Serdyukov At most 1.5× optimal (metric) Polynomial Theory baseline
Nearest neighbour None constant O(n^2) Starting tours
2-opt, Lin-Kernighan None in the worst case Fast in practice Near-optimal tours at scale

What TSP means for P vs NP

Because the decision version is NP-complete, TSP is tied directly to the P vs NP question. A polynomial-time algorithm for it would give polynomial-time algorithms for every problem in NP, proving P = NP. A proof that no such algorithm exists would prove P ≠ NP. Neither has happened. For the background, see P vs NP explained.

The records above do not contradict this. Concorde and LKH succeed on real instances because those instances have structure, not because they escape exponential worst-case behavior. Christofides and its 2020 improvement are approximations, not exact algorithms, and the 123/122 hardness result shows that even approximating metric TSP well enough would already imply P = NP.

Questions

Is the traveling salesman problem NP-complete?

The decision version, which asks whether a tour of length at most k exists, is NP-complete. The optimization version, which asks for the shortest tour, is NP-hard; it is not in NP as usually stated because it is not a yes/no question.

What is the best algorithm for the travelling salesman problem?

It depends on the goal. For a proven optimal tour on large instances, branch-and-cut solvers such as Concorde are the standard. For a very good tour quickly, Lin-Kernighan style local search (for example LKH) is the usual choice.

Can the travelling salesman problem be solved in polynomial time?

No polynomial-time algorithm is known. Finding one for the decision version would prove P = NP, which remains unsolved.

What is the largest TSP instance solved to optimality?

The largest instance in the TSPLIB benchmark library solved with a proof of optimality is pla85900, with 85,900 cities, solved with Concorde in 2006. In 2025 William Cook and Sang-il Oum proved optimal a walking tour of 81,998 bars in South Korea.

How good is the Christofides algorithm?

For metric TSP, where distances obey the triangle inequality, it always returns a tour at most 1.5 times the optimum. In 2020 Karlin, Klein and Oveis Gharan gave a randomized algorithm that beats 1.5 by a tiny constant, above 10^-36.

Sources

  1. Richard M. Karp, Reducibility among combinatorial problems (1972)
  2. Karp's 21 NP-complete problems (Wikipedia)
  3. Travelling salesman problem (Wikipedia)
  4. Held-Karp algorithm (Wikipedia), on Bellman 1962 and Held and Karp 1962
  5. de Berg, Bodlaender, Kisfaludi-Bak and Kolay, An ETH-tight exact algorithm for Euclidean TSP (notes that a (2-ε)^n algorithm for TSP is open)
  6. Christofides algorithm (Wikipedia)
  7. van Bevern and Slugina, A historical note on the 3/2-approximation algorithm for the metric traveling salesman problem (2020)
  8. Karlin, Klein and Oveis Gharan, A (slightly) improved approximation algorithm for metric TSP (arXiv 2020, STOC 2021)
  9. Karpinski, Lampis and Schmied, New inapproximability bounds for TSP (arXiv 2013, JCSS 2015)
  10. Toronto lecture notes, inapproximability of general TSP
  11. Lin and Kernighan, An effective heuristic algorithm for the traveling-salesman problem, Operations Research 21(2), 1973
  12. Lin-Kernighan heuristic (Wikipedia), including Helsgaun's LKH
  13. 2-opt (Wikipedia)
  14. Nearest neighbour algorithm (Wikipedia)
  15. Concorde TSP Solver, University of Waterloo
  16. pla85900 project page, University of Waterloo
  17. pla85900 CPU time, University of Waterloo
  18. Korea bars tour (81,998 stops), University of Waterloo
  19. Korea bars tour, computation details

Get one email the day P vs NP changes status.

Get the alert