Learn
Lesson · Intractability and Approximation · Hardness that travels

Circuits, Tours and the Chain

The cleanest reduction in the kit: distance 1 where the graph has an edge, 2 where it does not, budget n. A tour costs n exactly when every step is an edge, so the tours within budget and the Hamilton circuits are literally the same list — the map on solutions is the identity on the vertex sequence. The lab enumerates both lists and compares them, and the page then says what the same trick does to approximability.

distance 1 on an edge, 2 off it, budget n a tour has n steps, so it costs at least n, and exactly n only if every step is an edge the five-cycle: 12 tours considered, 1 within budget, 1 Hamilton circuit, same list shortest tour 5, budget 5, and the two yes-or-no answers agree replace 2 by something huge and a constant-factor approximation would decide Hamilton
One distance matrix, two solution lists, and the identity between them

Core ideas

What this lesson establishes

One idea about why this reduction is so tight, one about what a chain of reductions buys, and one about turning a reduction into a statement that no approximation is possible — which is the bridge to the second half of the course.

1

The tightest kind of map: the identity

Most reductions rename the objects. This one does not: a tour of the constructed instance is a cyclic order of the cities, a Hamilton circuit is a cyclic order of the vertices, and they are the same sequences. So the map on solutions is the identity, restricted to the tours that come in under budget. The lab still checks it, by enumerating both lists and comparing them as sets, because a construction whose correctness is obvious is exactly the kind that ships with an off-by-one in the budget.

2

A chain of reductions needs only its links

Reductions compose: if A ≤p B and B ≤p C then A ≤p C, because the composition of two polynomial maps is polynomial. That is what makes a library of hardness results cheap — nobody reduces satisfiability to the travelling salesman directly. The route runs through several problems, and each link is a construction of the kind built on these pages.

3

The same gadget with a bigger number forbids approximation

Put 1 on the edges and something enormous off them — 2n rather than 2 — and a Hamilton circuit still costs n while any tour missing an edge costs more than 2n. An algorithm promising to come within a factor 2 of the optimum would therefore have to return a tour of cost at most 2n when a circuit exists, and could not when none does, so it would decide the Hamilton circuit problem. That is why the approximation half of this course restricts to distances obeying the triangle inequality: without some hypothesis there is nothing to prove.

The material

The distance matrix, the two lists, and the argument that kills approximation

The construction, why the budget is exactly n, what the lab enumerates, how reductions compose, and the variant that rules out a constant factor.

Definition · Hamilton circuit, and the travelling salesman

A Hamilton circuit is a cycle visiting every vertex of a graph exactly once. The travelling salesman decision problem takes a distance for every pair of cities and a budget, and asks whether some tour visiting every city once and returning costs at most the budget.

The construction

for every pair u, v: D[u][v] = 1 if uv is an edge of G D[u][v] = 2 if it is not budget B = n, the number of vertices
Theorem · The construction is a reduction

The graph has a Hamilton circuit if and only if the constructed instance has a tour of cost at most n.

A tour visits n cities and returns, so it takes exactly n steps, and every step costs 1 or 2. Its cost is therefore at least n, with equality exactly when every step costs 1, that is, when every step is an edge of G — which makes the tour a Hamilton circuit.

So if a Hamilton circuit exists it is a tour of cost exactly n, which is within budget; and if a tour of cost at most n exists then its cost is exactly n, every step is an edge, and it is a Hamilton circuit. The two lists of solutions are therefore equal as sets of cyclic sequences, which is stronger than the reduction needs.

□

What the lab enumerated

The loaded graph is the five-cycle. The panel reports 5 vertices and 5 edges, a budget of 5, 12 tours considered, 1 tour within budget, 1 Hamilton circuit, the verdict that the two lists are the same list, a shortest tour of 5, and the two answers agreeing. The single tour within budget is the cycle itself.

Twelve is (n − 1)! divided by 2: a tour is counted once rather than twice for itself and its reverse, and it is counted starting from city 1. Getting that convention wrong is a real hazard here, because counting a cycle and its reverse separately would make a bijection look like a two-to-one map, and the panel's verdict on the map would then be wrong for a reason having nothing to do with the construction.

Example · Why the other eleven tours cost more

The five-cycle has 5 edges out of 10 pairs, so half the distances are 2. Any ordering other than the cycle itself must use at least one non-edge, so it costs at least 6 — and the panel's table shows no tour of 6 at all. The lengths across the twelve are 5, 7, 8 and 10, because dropping one edge of the cycle leaves a path whose ends are joined only by that same edge: using one non-edge forces a second. The budget separates the one from the eleven, and it is the only thing doing the separating.

Composing reductions, and where this one sits

Satisfiability is not reduced to the travelling salesman in one step by anyone. The route runs through a sequence of problems, each link a construction with its own gadget, and composition does the rest: two polynomial maps compose to a polynomial map, and the yes-or-no equivalences compose to a yes-or-no equivalence. This page builds the last link, and the link from independent set to Hamilton circuit is stated here and built nowhere in this library — its gadget needs more vertices than the lab can enumerate over.

That gap is worth being explicit about rather than papering over with an arrow. What has been built in front of you on this course is: search from decision, satisfiability to independent set, the identity carrying independent set to vertex cover and clique, satisfiability to subset sum, and Hamilton circuit to the travelling salesman. What is quoted and not built is Cook–Levin — that satisfiability is NP-complete at all — and the middle of the chain into Hamilton circuits.

Theorem · No constant-factor approximation for the general travelling salesman

If for some constant ρ ≥ 1 there is a polynomial-time algorithm always returning a tour of cost at most ρ times the optimum, then the Hamilton circuit problem is solvable in polynomial time, and hence P = NP.

B

u

i

l

d

t

h

e

d

i

s

t

a

n

c

e

m

a

t

r

i

x

w

i

t

h

1

o

n

t

h

e

e

d

g

e

s

a

n

d

`

ρ

·

n

+

1

`

o

f

f

t

h

e

m

,

w

h

i

c

h

i

s

s

t

i

l

l

p

o

l

y

n

o

m

i

a

l

t

o

w

r

i

t

e

d

o

w

n

.

I

f

`

G

`

h

a

s

a

H

a

m

i

l

t

o

n

c

i

r

c

u

i

t

t

h

e

o

p

t

i

m

u

m

i

s

e

x

a

c

t

l

y

`

n

`

,

s

o

t

h

e

a

l

g

o

r

i

t

h

m

m

u

s

t

r

e

t

u

r

n

a

t

o

u

r

o

f

c

o

s

t

a

t

m

o

s

t

`

ρ

·

n

`

.

I

f

`

G

`

h

a

s

n

o

n

e

,

e

v

e

r

y

t

o

u

r

u

s

e

s

a

n

o

n

-

e

d

g

e

a

n

d

c

o

s

t

s

m

o

r

e

t

h

a

n

`

ρ

·

n

`

.

S

o

t

h

e

r

e

t

u

r

n

e

d

c

o

s

t

d

e

c

i

d

e

s

w

h

e

t

h

e

r

a

H

a

m

i

l

t

o

n

c

i

r

c

u

i

t

e

x

i

s

t

s

,

a

n

d

t

h

e

w

h

o

l

e

p

r

o

c

e

d

u

r

e

i

s

p

o

l

y

n

o

m

i

a

l

.

□

The lab uses 2 rather than ρ · n + 1, because 2 is what the decision reduction needs and small numbers are what a five-city enumeration can show. The inapproximability variant is the same gadget with the off-edge distance raised, and this panel cannot do that — its distances are derived from the graph rather than typed, so the variant is an argument here and a slider in “The Hypothesis Doing the Work”. What it means for the rest of the course is stark: approximation is not available for this problem as stated, so the next approximation of a tour will come with a hypothesis attached.

Interactive

Hamilton circuit to travelling salesman

Distance 1 on an edge and 2 off it, budget n — the tours within budget and the Hamilton circuits come out as the same list

Hamilton circuit to travelling salesmandistance 1 on an edge, 2 off it, budget n — and the two solution lists come out identical
the tour shownwithin budget, so a circuita step that is not an edge

Method

Checking a reduction whose correctness looks obvious

The argument is three lines, so the risk moves entirely into the details around it.

1

Count the steps in a tour before setting the budget

A tour of n cities has n steps, not n - 1: it returns. The budget is n because the cheapest possible step costs 1. An off-by-one here makes the reduction either trivially true or trivially false, and the enumeration will still look healthy.

2

Fix a canonical form for a solution

A cycle, its rotations and its reverse are one circuit. Decide that a tour starts at city 1 and that its second city is smaller than its last, and apply the same rule to both lists. The comparison of the two solution sets is meaningless unless both are canonicalised the same way.

3

Enumerate both sides and compare them as sets

Not the counts — the sets. Two lists of the same length can differ, and this is the one reduction on the course where the comparison is available in full because the map is the identity.

4

Check a no instance too

The panel's path and bowtie examples have no Hamilton circuit; the shortest tour comes to 5 against a budget of 4 in one and 6 against 5 in the other. A reduction verified only where the answer is yes has been verified on half of the equivalence.

5

Ask what the off-edge distance is doing before claiming anything about approximation

With 2 off the edges the construction proves the decision problem hard. With ρ · n + 1 it proves no ρ-approximation exists. Same gadget, different constant, completely different theorem — and the second is the one that explains the shape of everything after this page.

Budgets, compositions and constants

Score 0 / 0

Twelve tours on the five-cycle, and the one within budget

The graph is 1-2, 2-3, 3-4, 4-5, 5-1, so the distance is 1 on those five pairs and 2 on the other five. Each tour is written starting at city 1, with its reverse counted once.

tour length within budget 5? a Hamilton circuit? 1-2-3-4-5 5 yes yes 1-2-3-5-4 7 no no 1-2-4-3-5 7 no no 1-2-4-5-3 8 no no 1-2-5-3-4 8 no no 1-2-5-4-3 7 no no 1-3-2-4-5 7 no no 1-3-2-5-4 8 no no 1-3-4-2-5 8 no no 1-3-5-2-4 10 no no 1-4-2-3-5 8 no no 1-4-3-2-5 7 no no tours considered 12 within budget 1 Hamilton circuits 1 the two lists are the same list shortest tour 5 = the budget

The last row is the worst tour and it is worth reading: 1-3-5-2-4 uses five non-edges and costs 10, which is twice the budget. In the five-city instance every step is either 1 or 2, so every tour costs between 5 and 10, and the whole question is whether any of them lands on the lower end.

Switch to the five-cycle with a chord added and the tour list does not move: still 12 tours, still one within budget, still one circuit. The extra edge changes one distance from 2 to 1 and lowers several tour lengths — 1-2-5-4-3 drops from 7 to 6 — without creating a new Hamilton circuit. The answer is a property of the graph and not of the distances it happens to produce.

For a faded rehearsal, load the bowtie — two triangles sharing a vertex — and predict the shortest tour before running it. The supplied first move: the shared vertex is a cut vertex, so any circuit would have to pass through it twice, which no tour may do. Say what that forces about the number of non-edges in every tour, and then check the shortest length against the budget.

Common mistakes

1
Counting a tour and its reverse as two solutionsOn an undirected instance they are one circuit. Counting both doubles one list without doubling the other and turns a verified identity into a spurious two-to-one map. Canonicalise before comparing, and apply the same rule to both sides.
2
Reading this reduction as a statement about approximationIt says the decision problem is hard. The inapproximability result is a different construction with the same shape and a much larger constant, and it is proved on this page rather than implied by the lab. A page showing distances of 1 and 2 has shown an instance where a factor of 2 is free.
3
Treating the chain as though every link were built hereTwo links in the standard chain are quoted rather than constructed in this library: that satisfiability is NP-complete at all, and the route from independent set into Hamilton circuits. Knowing which of your beliefs rest on a construction you have seen is the point of building the others.

Check your understanding

✓
Finish when you can write the distance matrix, justify the budget, and state the two different theorems the same gadget gives.

You should be able to construct the instance from a graph, prove both directions of the equivalence from the step count, canonicalise a tour so the two solution lists can be compared, explain why reductions compose, and derive the inapproximability statement by raising the off-edge distance.

Note: That is the last reduction on this course. From here the question changes from “is this problem hard” to “what can honestly be done about it”, and “A Bound the Search Can See” starts with the answer that gives up nothing: an exact algorithm that is still exponential and prunes anyway.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.