A Bit of History
Before Michael Held and Richard Karp's 1962 dynamic-programming breakthrough (covered in its own deep dive), the earliest computational attacks on TSP were purely combinatorial. Brute-force permutation search is the mathematically obvious baseline every TSP researcher starts from — it requires no cleverness, only patience (and a very fast computer, or a very small city count). The Sorted Edges method (also called Cheapest Link) emerged from operations research practice in the 1970s as a simple greedy alternative to Nearest Neighbor, building the tour by edges rather than by city-visitation order — a subtly different greedy philosophy that sometimes avoids Nearest Neighbor's worst pitfalls.
TSP Brute Force: Permutation Enumeration
Fix a starting city (WLOG, since a tour is a cycle), then enumerate every permutation of the remaining $n-1$ cities, compute each permutation's total tour cost, and keep the cheapest. This guarantees the true optimal tour, at the cost of $O((n-1)!)$ time.
Symmetry Reduction
For symmetric TSP (distance $A \to B$ equals distance $B \to A$), every tour and its reverse have identical cost — so only $(n-1)!/2$ distinct permutations need to be checked, immediately halving the brute-force search space for free.
TSP Backtracking: Bounding & Pruning
Rather than generating every full permutation before evaluating it, backtracking builds a partial tour incrementally and abandons a branch the moment its partial cost already exceeds the best complete tour found so far (branch-and-bound pruning):
- Maintain a running "best known tour cost" (initialized to $\infty$, or a quick heuristic solution like Nearest Neighbor).
- Build the tour city by city; after adding each city, check if the partial cost already exceeds the best known — if so, prune this branch immediately (no permutation extending it can possibly improve on the best).
- Whenever a complete tour is found with a cost better than the current best, update the best known cost.
Sorted Edges (Cheapest Link)
Instead of building a tour by choosing the next city to visit (as Nearest Neighbor does), Sorted Edges builds a tour by choosing the cheapest available edges across the entire graph, subject to two constraints that keep the growing edge set a valid partial tour:
- Sort all edges by ascending weight.
- Process edges in that order; add an edge to the tour if and only if (a) neither endpoint already has degree 2 (a valid tour visits each city exactly once, meaning exactly 2 tour-edges per city), and (b) adding it would not close a cycle smaller than the full $n$-city tour (a "premature subtour").
- Continue until exactly $n$ edges have been selected, forming one single Hamiltonian cycle.
Worked Example
4-city symmetric TSP with distances: AB=10, AC=15, AD=20, BC=35, BD=25, CD=30.
- Sorted edges (ascending): AB(10), AC(15), BD(25), CD(30), BC(35), AD(20) — wait, sort correctly: AB(10), AC(15), AD(20), BD(25), CD(30), BC(35).
- Add AB(10): degrees A=1, B=1. Add AC(15): degree A becomes 2 (max reached) — but wait, this would make A's degree 2 while B and C both still need one more edge. Add AD(20): A already has degree 2 (from AB, AC) — skip, would exceed degree 2. Add BD(25): degrees B=2, D=1. Add CD(30): degrees C=2, D=2 — completes the tour with exactly 4 edges: AB, AC, BD, CD, forming cycle A-B-D-C-A. Total cost: 10+25+30+15 = 80.
Complexity Analysis
| Method | Time Complexity | Guarantee |
|---|---|---|
| Brute Force | $O(n!)$ | Exact optimum |
| Backtracking (pruned) | $O(n!)$ worst case, far better in practice | Exact optimum |
| Sorted Edges | $O(n^2 \log n)$ (dominated by edge sorting) | Heuristic, no guarantee |
Implementation
Real-World Applications
Small-Instance Exact Routing & Baseline Benchmarking
Brute force and backtracking remain genuinely useful for tiny TSP instances (under ~15 cities), such as verifying a delivery route across a small number of daily stops where an exact optimum is both achievable and valuable. Sorted Edges is frequently used as a quick baseline constructive method in TSP research papers, providing a fast initial tour that local-search methods (2-opt, 3-opt) can then refine.
Exercises
- Solve a 6-city symmetric TSP instance using brute force and compare its runtime to backtracking with pruning.
- Explain why Sorted Edges must check for "premature subtours" — construct an example where naively adding cheap edges would create a small cycle before all cities are included.
- Compare the tour quality of Sorted Edges versus Nearest Neighbor on the same 6-city instance.
- Challenge: Combine Sorted Edges with a subsequent 2-opt refinement pass and measure the improvement over Sorted Edges alone.
Limitations
Factorial Growth & No Quality Guarantee
Brute force and backtracking become computationally infeasible well before 20 cities, even with aggressive pruning. Sorted Edges offers no worst-case approximation guarantee (unlike Christofides' proven 3/2-approximation) — its subtour-avoidance bookkeeping can also occasionally force an expensive "forced" edge late in construction when better options have already been used elsewhere.