Simple Algorithm
Algorithms & Data Structures · Optimal · 28 min

Approximating the Traveling Salesman

Tree doubling, Christofides, and the 2021 improvement.

For 45 years nobody could beat the factor 3/23/2 that Christofides proved for metric TSP in 1976; in 2021 a randomized algorithm finally did, by a sliver larger than 10−3610^{-36}. Meanwhile exact solvers prove tours through tens of thousands of cities optimal. Both feats rest on the same few lower bounds on the optimal tour.

What you’ll learn

  • Compute and compare the lower bounds behind TSP algorithms: the minimum spanning tree, the 1-tree and the Held–Karp bound, which equals the subtour LP.
  • Prove the Christofides–Serdyukov guarantee of 3/23/2 in full, show that it is tight, and strengthen it to 32\tfrac32 times the subtour LP using TT-joins.
  • Describe the max-entropy approach behind the 2021 improvement to 32−ε\tfrac32 - \varepsilon, and the progress on graphic and asymmetric TSP.
  • Explain Arora's approximation scheme for Euclidean TSP, the 123/122123/122 hardness of metric TSP, and why Lin–Kernighan search and branch and cut dominate practice.

Lower bounds: trees, 1-trees and the subtour LP

Every approximation guarantee and every exact solver rests on lower bounds on OPT\mathrm{OPT}. Here are three, in increasing strength:

BoundDefinitionWhy it is at most OPT\mathrm{OPT}
Minimum spanning treethe lightest tree on all the citiesa tour minus one edge is a spanning tree
1-tree (Held & Karp, 1970)a minimum spanning tree on cities 1,…,n−11, \dots, n-1, plus the two cheapest edges at city 0a tour is a 1-tree: a path through cities 1,…,n−11, \dots, n-1 plus two edges at city 0
Held–Karp boundmax⁡π[min⁡1-tree T ∑ij∈T(cij+πi+πj)−2∑iπi]\max_\pi \Big[\min_{1\text{-tree } T}\ \sum_{ij \in T}(c_{ij} + \pi_i + \pi_j) - 2\sum_i \pi_i\Big]every city has degree 2 in a tour, so the penalties raise every tour's cost by exactly 2∑iπi2\sum_i \pi_i
The potentials πi\pi_i are Lagrange multipliers for the degree constraints: raising πi\pi_i makes city ii expensive, which pushes the minimum 1-tree toward degree 2 there.
min⁡∑ecexes.t.x(δ(v))=2  ∀v,x(δ(S))≥2  ∀ ∅≠S⊊V,0≤xe≤1\min \sum_{e} c_e x_e \quad\text{s.t.}\quad x(\delta(v)) = 2\ \ \forall v, \qquad x(\delta(S)) \ge 2\ \ \forall\, \emptyset \ne S \subsetneq V, \qquad 0 \le x_e \le 1
δ(S)\delta(S) is the set of edges with exactly one endpoint in SS. There are exponentially many cut constraints, but a violated one, if any, is found by a minimum-cut computation, so the LP is solvable in polynomial time by the ellipsoid method, and in practice by adding cuts as they are needed.
python
import math

def one_tree(d, pi):
    """Lower bound and degrees of a minimum 1-tree under costs d[i][j] + pi[i] + pi[j]."""
    n, c = len(d), lambda i, j: d[i][j] + pi[i] + pi[j]
    deg, w = [0] * n, 0.0
    best = {v: (c(1, v), 1) for v in range(2, n)}           # Prim's algorithm on cities 1..n-1
    while best:
        v = min(best, key=lambda x: best[x][0])
        cost, u = best.pop(v)
        w, deg[u], deg[v] = w + cost, deg[u] + 1, deg[v] + 1
        for x in best:
            if c(v, x) < best[x][0]:
                best[x] = (c(v, x), v)
    a, b = sorted(range(1, n), key=lambda j: c(0, j))[:2]     # the two cheapest edges at city 0
    w, deg[0], deg[a], deg[b] = w + c(0, a) + c(0, b), 2, deg[a] + 1, deg[b] + 1
    return w - 2 * sum(pi), deg

def held_karp_bound(d, steps=2000):
    pi, best = [0.0] * len(d), 0.0
    for k in range(steps):
        bound, deg = one_tree(d, pi)
        best = max(best, bound)                               # every pi gives a lower bound
        if all(g == 2 for g in deg):
            break                                             # this 1-tree is a tour: optimal
        pi = [p + (g - 2) / math.sqrt(k + 1) for p, g in zip(pi, deg)]
    return best

pts = [(40, 50), (53, 37), (69, 59), (51, 22), (18, 18), (21, 46), (77, 33), (21, 78)]
d = [[math.dist(p, q) for q in pts] for p in pts]
print(round(one_tree(d, [0.0] * 8)[0], 1), round(held_karp_bound(d), 1))   # 197.9 224.3

Subgradient ascent on the potentials (Held & Karp, 1971), with a crude step size. The points are the eight starting cities of the traveling-salesman widget below and in the Optimized lesson. The plain 1-tree gives 197.9; after 28 iterations the 1-tree becomes a tour, and the bound reaches 224.3, the optimum itself. The minimum spanning tree weighs only 164.6.

The subtour LP is the strongest lower bound with a proven guarantee, and the backbone of exact solvers. Its integrality gap is at least 4/34/3, approached by known families of instances, and at most 3/23/2, as the next step proves. The conjecture that it is exactly 4/34/3 has been open for decades.

Check your understanding

Why is the Held–Karp expression a valid lower bound on OPT\mathrm{OPT} for every choice of potentials π\pi, not just the best one?

  1. Because the potentials are chosen so that the minimum 1-tree is a tour
  2. Because every tour is a 1-tree in which each city has degree 2, so the penalties add exactly 2∑iπi2\sum_i \pi_i to its cost, and subtracting that back gives at most the tour's true cost
  3. Because of the triangle inequality
  4. Because the minimum 1-tree is unique
Show the answer

B. Because every tour is a 1-tree in which each city has degree 2, so the penalties add exactly 2∑iπi2\sum_i \pi_i to its cost, and subtracting that back gives at most the tour's true cost

For any π\pi, the minimum penalized 1-tree costs at most the penalized optimal tour, which is OPT+2∑iπi\mathrm{OPT} + 2\sum_i\pi_i. Subtracting 2∑iπi2\sum_i\pi_i leaves at most OPT\mathrm{OPT}. Ascent only tightens a bound that is valid all along.

Christofides–Serdyukov: 3/2

DerivationProof
  1. c(T) ≤ OPTc(T)\ \le\ \mathrm{OPT}

    The tree. A tour minus an edge is a spanning tree:

  2. ∑vdeg⁡T(v)=2(n−1) ⇒ ∣O∣ is even\sum_{v} \deg_T(v) = 2(n - 1)\ \Rightarrow\ \abs{O}\ \text{is even}

    OO has even size. The degrees in TT sum to 2(n−1)2(n - 1), so an even number of them are odd (the handshake lemma), and a perfect matching on OO exists in the complete graph.

  3. c(M) ≤ min⁡(∑i oddc(oioi+1), ∑i evenc(oioi+1)) ≤ 12 OPT(o2k+1=o1)c(M)\ \le\ \min\Big(\sum_{i \text{ odd}} c(o_i o_{i+1}),\ \sum_{i \text{ even}} c(o_i o_{i+1})\Big)\ \le\ \tfrac12\,\mathrm{OPT} \qquad (o_{2k+1} = o_1)

    The matching costs at most half. Shortcut an optimal tour to visit only the vertices of OO, in the same cyclic order; by the triangle inequality the cycle o1,o2,…,o2ko_1, o_2, \dots, o_{2k} costs at most OPT\mathrm{OPT}. Its edges alternate between two perfect matchings of OO, and the cheaper one costs at most half of the cycle:

  4. c(circuit) = c(T)+c(M) ≤ 32 OPTc(\text{circuit})\ =\ c(T) + c(M)\ \le\ \tfrac32\,\mathrm{OPT}

    Euler circuit. Adding MM raises the degree of exactly the odd vertices by one, so every degree in the connected multigraph T+MT + M is even, and it has an Euler circuit, which Hierholzer's algorithm finds in linear time:

  5. c(tour) ≤ 32 OPTc(\text{tour})\ \le\ \tfrac32\,\mathrm{OPT}

    Shortcut the circuit to a tour, which by the triangle inequality costs no more. Edmonds' blossom algorithm finds MM in O(n3)O(n^3) time, which dominates the running time.

DerivationProof with T-joins
  1. c(T) ≤ (1−1n) c⊤x ≤ LPc(T)\ \le\ \big(1 - \tfrac1n\big)\,c^\top x\ \le\ \mathrm{LP}

    Tree. The cut constraints give x(E(S))=12(2∣S∣−x(δ(S)))≤∣S∣−1x(E(S)) = \tfrac12\big(2\abs{S} - x(\delta(S))\big) \le \abs{S} - 1 for every proper subset SS, and x(E)=nx(E) = n. So (1−1n) x(1 - \tfrac1n)\,x lies in Edmonds' spanning-tree polytope, whose vertices are spanning trees, and the minimum spanning tree costs at most its value:

  2. min⁡J c(J) ≤ 12 c⊤x = 12 LP\min_J\ c(J)\ \le\ \tfrac12\,c^\top x\ =\ \tfrac12\,\mathrm{LP}

    Join. For an even-size set OO, an OO-join is a set of edges in which exactly the vertices of OO have odd degree. By Edmonds and Johnson (1973), the cheapest OO-join costs min⁡{c⊤y:y≥0, y(δ(S))≥1\min\{c^\top y : y \ge 0,\ y(\delta(S)) \ge 1 whenever ∣S∩O∣\abs{S \cap O} is odd}\}. Every cut has x(δ(S))≥2x(\delta(S)) \ge 2, so y=x/2y = x/2 is feasible:

  3. c(tour) ≤ c(T)+c(M) ≤ 32 LP ≤ 32 OPTc(\text{tour})\ \le\ c(T) + c(M)\ \le\ \tfrac32\,\mathrm{LP}\ \le\ \tfrac32\,\mathrm{OPT}

    Matching. An OO-join splits into paths that pair up the vertices of OO (plus cycles); shortcutting each path to a single edge gives a perfect matching on OO that costs no more. So c(M)≤12 LPc(M) \le \tfrac12\,\mathrm{LP}, and:

Below 3/2: random spanning trees

On the zigzag instance both halves of the Christofides bound are nearly tight at once: the tree costs almost OPT\mathrm{OPT} and the parity correction almost OPT/2\mathrm{OPT}/2. No sharper analysis of the same algorithm can help; the algorithm must change. Beating 3/23/2 means choosing the tree with its parity correction in mind, and the idea that worked replaces the minimum spanning tree by a random spanning tree whose distribution comes from the LP solution.

DerivationThe max-entropy algorithm (Oveis Gharan, Saberi & Singh, 2011)
  1. Pr⁡T∼μ[ e∈T ] = zefor every edge e\Pr_{T \sim \mu}[\,e \in T\,]\ =\ z_e \quad\text{for every edge } e

    A distribution over trees. Solve the subtour LP. As in Wolsey's proof, z=(1−1n) xz = (1 - \tfrac1n)\,x lies in the spanning-tree polytope, so it is the vector of edge marginals of some probability distribution over spanning trees. Among all such distributions, take the one of maximum entropy; it has the form Pr⁡[T]∝∏e∈Tλe\Pr[T] \propto \prod_{e \in T}\lambda_e, and the weights λe\lambda_e can be computed (approximately) in polynomial time.

  2. E[c(T)] = c⊤z ≤ LP\mathbb{E}[c(T)]\ =\ c^\top z\ \le\ \mathrm{LP}

    Tree plus join. Sample TT, add a minimum-cost OTO_T-join for its odd vertices, find an Euler circuit and shortcut. The tree costs at most LP\mathrm{LP} in expectation:

  3. E[c(T)+c(J)] ≤ (32−ε) OPT\mathbb{E}\big[c(T) + c(J)\big]\ \le\ \big(\tfrac32 - \varepsilon\big)\,\mathrm{OPT}

    Where the gain must come from. The join only has to cross cuts that TT crosses an odd number of times. Near-minimum cuts (x(δ(S))≈2x(\delta(S)) \approx 2) are where x/2x/2 is tight, and a random tree crosses many of them exactly twice, an even number. Max-entropy distributions are strongly Rayleigh, with strong negative correlation between edges, and that is what lets one prove that enough cuts are even often enough to build a fractional join that is cheaper than x/2x/2 by a constant fraction, in expectation:

The constant is tiny because the analysis loses constants at every step, not because the method is weak; nobody knows how large ε\varepsilon really is for this algorithm. Two neighboring problems moved earlier and further:

ProblemMilestones
Graphic TSP (shortest-path metric of an unweighted graph)32−ε0\tfrac32 - \varepsilon_0 with max-entropy trees (Oveis Gharan, Saberi & Singh, 2011); 1.4611.461 (Mömke & Svensson, 2011); 13/913/9 (Mucha, 2012); 7/57/5 (Sebő & Vygen, 2014)
Asymmetric TSP (cij≠cjic_{ij} \ne c_{ji} allowed, triangle inequality kept)log⁡2n\log_2 n (Frieze, Galbiati & Maffioli, 1982); O(log⁡n/log⁡log⁡n)O(\log n/\log\log n) via thin trees (Asadpour, Goemans, Mądry, Oveis Gharan & Saberi, 2010); the first constant factor (Svensson, Tarnawski & Végh, STOC 2018), since lowered to about 22 (Traub & Vygen)
Asymmetric TSP shows how far theory and practice can diverge: constant-factor algorithms arrived only in 2018, yet asymmetric instances are routinely solved in practice.
Check your understanding

Why did beating 3/23/2 require a new idea rather than a sharper analysis of Christofides' algorithm?

  1. Because a minimum-cost perfect matching cannot be computed exactly in polynomial time
  2. Because approximating metric TSP within 3/23/2 is NP-hard
  3. Because the subtour LP has integrality gap exactly 3/23/2
  4. Because on some instances, such as the zigzag, Christofides' algorithm really returns nearly 32 OPT\tfrac32\,\mathrm{OPT}, so the tree must be chosen with the parity correction in mind
Show the answer

D. Because on some instances, such as the zigzag, Christofides' algorithm really returns nearly 32 OPT\tfrac32\,\mathrm{OPT}, so the tree must be chosen with the parity correction in mind

The zigzag family drives Christofides' ratio to 3/23/2, so no sharper analysis of the same algorithm can help: the algorithm itself must change. Sampling a random tree linked to the LP solution was the change that worked.

Geometry, hardness and practice

For points in the plane with Euclidean distances, TSP remains NP-hard (Papadimitriou, 1977), but it has a PTAS, found independently by Arora (1998) and Mitchell (1999), who shared the 2010 Gödel Prize for it.

DerivationArora's scheme in four moves
  1. L = O(n/ε)L\ =\ O(n/\varepsilon)

    Snap. Scale and round the coordinates to integers in a box of side L=O(n/ε)L = O(n/\varepsilon). Each point moves by a tiny fraction of OPT/n\mathrm{OPT}/n, so the optimum changes by a factor of only 1+O(ε)1 + O(\varepsilon).

  2. depth = O(log⁡n)\text{depth}\ =\ O(\log n)

    Dissect. Build a quadtree over the box whose origin is shifted by a uniformly random vector. It has depth O(log⁡L)O(\log L), which is O(log⁡n)O(\log n) for fixed ε\varepsilon.

  3. Eshift[ OPTportal−OPT ] ≤ ε⋅OPT\mathbb{E}_{\text{shift}}\big[\,\mathrm{OPT}_{\text{portal}} - \mathrm{OPT}\,\big]\ \le\ \varepsilon\cdot\mathrm{OPT}

    Structure theorem. Place m=O((log⁡n)/ε)m = O((\log n)/\varepsilon) evenly spaced portals on the sides of every square. Over the random shift, the cheapest tour that crosses square boundaries only at portals, and each side of each square at most r=O(1/ε)r = O(1/\varepsilon) times, costs at most ε OPT\varepsilon\,\mathrm{OPT} more than the optimum in expectation; a patching lemma removes excess crossings cheaply.

  4. time = n (log⁡n)O(1/ε)\text{time}\ =\ n\,(\log n)^{O(1/\varepsilon)}

    Dynamic programming. For every square and every interface, meaning which portals the tour uses and how the crossings pair up inside the square, store the cheapest way to visit the square's points. A square has mO(r)=(log⁡n)O(1/ε)m^{O(r)} = (\log n)^{O(1/\varepsilon)} interfaces, and the quadtree has O(nlog⁡n)O(n \log n) nonempty squares:

The scheme cannot be made fully polynomial in 1/ε1/\varepsilon, because Euclidean TSP is strongly NP-hard. For general metrics no PTAS exists at all unless P = NP: metric TSP is APX-hard, already with distances 1 and 2 (Papadimitriou & Yannakakis, 1993), and approximating it within 123/122123/122 is NP-hard (Karpinski, Lampis & Schmied, 2015). Between 123/122≈1.008123/122 \approx 1.008 and 1.51.5 lies one of the widest open gaps of approximation theory.

In practice nobody runs Christofides alone. Local search dominates: 2-opt (Croes, 1958), 3-opt, and above all the variable-depth moves of Lin and Kernighan (1973), refined in Helsgaun's LKH. Exact solvers combine the subtour LP with many further families of cutting planes inside branch and bound, an approach called branch and cut. Concorde (Applegate, Bixby, Chvátal & Cook) solved every instance of the TSPLIB benchmark library; the largest, pla85900, a chip-layout instance with 85,900 cities, was solved in 2006 using about 136 CPU-years, and its optimal length matched a tour that LKH had found before the proof.

Key takeaways

  • TSP lower bounds form a chain: minimum spanning tree ≤\le 1-tree ≤\le Held–Karp bound == subtour LP ≤OPT\le \mathrm{OPT}; the subtour LP's integrality gap lies between 4/34/3 and 3/23/2, conjecturally 4/34/3.
  • Christofides–Serdyukov (tree, minimum matching on the odd vertices, Euler circuit, shortcut) costs at most 32 OPT\tfrac32\,\mathrm{OPT}, even 32 LP\tfrac32\,\mathrm{LP} by the TT-join argument, and the zigzag instance shows that 3/23/2 is tight.
  • Karlin, Klein and Oveis Gharan beat 3/23/2 by ε>10−36\varepsilon > 10^{-36} with max-entropy random spanning trees; graphic TSP is down to 7/57/5, and asymmetric TSP now has constant-factor algorithms.
  • Euclidean TSP has a PTAS in n(log⁡n)O(1/ε)n(\log n)^{O(1/\varepsilon)} time; metric TSP is NP-hard to approximate within 123/122123/122. In practice, Lin–Kernighan search and branch and cut on the subtour LP solve instances with tens of thousands of cities.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Why does a spanning tree always have an even number of odd-degree vertices?

  1. Because a tree on nn vertices has exactly two leaves
  2. Because its degrees sum to 2(n−1)2(n - 1), an even number, and a sum of integers is even only if an even number of them are odd
  3. Because the triangle inequality forces degrees to pair up
  4. Because a minimum spanning tree has maximum degree 2
Show the answer

B. Because its degrees sum to 2(n−1)2(n - 1), an even number, and a sum of integers is even only if an even number of them are odd

Each edge contributes 2 to the degree sum, so the sum is 2(n−1)2(n - 1). A sum of integers is even exactly when an even number of its terms are odd: the handshake lemma, true for every graph.

Question 2

Where does the proof that c(M)≤12 OPTc(M) \le \tfrac12\,\mathrm{OPT} use the triangle inequality?

  1. In computing MM with Edmonds' blossom algorithm
  2. In splitting the cycle on OO into two perfect matchings
  3. In proving that ∣O∣\abs{O} is even
  4. In shortcutting the optimal tour to a cycle through the vertices of OO only
Show the answer

D. In shortcutting the optimal tour to a cycle through the vertices of OO only

Skipping the vertices outside OO replaces stretches of the optimal tour by single edges, which cost no more only because of the triangle inequality. The other steps are pure combinatorics.

Question 3

The subtour LP has exponentially many cut constraints. Why can it still be solved in polynomial time?

  1. Because only nn of the constraints can be tight at an optimum
  2. Because it is always integral, so a minimum spanning tree solves it
  3. Because a violated cut constraint can be found by a minimum-cut computation, and the ellipsoid method needs only such a separation oracle
  4. Because the simplex method runs in polynomial time on it
Show the answer

C. Because a violated cut constraint can be found by a minimum-cut computation, and the ellipsoid method needs only such a separation oracle

Given xx, compute a global minimum cut with capacities xex_e; if it is below 2, it is a violated constraint. Polynomial-time separation implies polynomial-time optimization by the ellipsoid method (Grötschel, Lovász & Schrijver). Solvers instead add violated cuts as they find them.

Question 4

Which statement about approximating TSP is correct, as of 2025?

  1. Metric TSP has a PTAS
  2. Christofides' 3/23/2 is known to be optimal unless P = NP
  3. TSP with arbitrary distances has a 2-approximation
  4. Euclidean TSP in the plane has a PTAS, while approximating metric TSP within 123/122123/122 is NP-hard
Show the answer

D. Euclidean TSP in the plane has a PTAS, while approximating metric TSP within 123/122123/122 is NP-hard

Arora and Mitchell gave approximation schemes for Euclidean TSP, but metric TSP is APX-hard, with the best hardness threshold 123/122123/122 (Karpinski, Lampis & Schmied). The best ratio, 32−ε\tfrac32 - \varepsilon, sits far above that threshold.

Further reading

  • N. Christofides, "Worst-case analysis of a new heuristic for the travelling salesman problem," Report 388, Graduate School of Industrial Administration, Carnegie Mellon University (1976).
  • M. Held & R. M. Karp, "The traveling-salesman problem and minimum spanning trees," Operations Research 18(6) (1970).
  • A. R. Karlin, N. Klein & S. Oveis Gharan, "A (slightly) improved approximation algorithm for metric TSP," Proceedings of STOC (2021).
  • S. Arora, "Polynomial time approximation schemes for Euclidean traveling salesman and other geometric problems," Journal of the ACM 45(5) (1998).
  • D. L. Applegate, R. E. Bixby, V. Chvátal & W. J. Cook, The Traveling Salesman Problem: A Computational Study (Princeton University Press, 2006).