Discrete MathematicsGraphs, Paths and Circuits6 of 6
Graphs, Paths and Circuits · 6

Hamilton Paths and Circuits

Instead of covering every line on a graph once, we now want a route that visits every dot exactly once.

1

Finding a Hamilton Circuit by Deduction

A Hamilton path visits every dot on a graph exactly once, and a Hamilton circuit visits every dot once and returns to the starting dot to close the loop. Unlike Euler circuits, there is no quick degree formula for Hamilton circuits because most lines on the board are unused decoys, so rather than tracing blindly, we narrow down the circuit by elimination.

Finding a Hamilton Circuit by Deduction
A\text{A}
B\text{B}
C\text{C}
D\text{D}
E\text{E}
F\text{F}
Text solution
Lock in degree 2 dotsDots A\text{A} and F\text{F} only touch two lines each, so both of their lines must be used to enter and leave.
deg⁡(A)=2  ⟹  lock in A–B, A–Ddeg⁡(F)=2  ⟹  lock in F–C, F–E\displaystyle \begin{aligned} &\deg(\text{A}) = \quota{2} \\ &\quad \implies \text{lock in } \locked{\text{A–B}}, \locked{\text{ A–D}} \\[6pt] &\deg(\text{F}) = \quota{2} \\ &\quad \implies \text{lock in } \locked{\text{F–C}}, \locked{\text{ F–E}} \end{aligned}
Cross out early loopsTaking B–D\struck{\text{B–D}} or C–E\struck{\text{C–E}} would close a 3-dot triangle while leaving the remaining dots on the board unvisited.
A–B–D–A closes early  ⟹  cross out B–DC–F–E–C closes early  ⟹  cross out C–E\displaystyle \begin{aligned} &\text{A–B–D–A closes early} \\ &\quad \implies \text{cross out } \struck{\text{B–D}} \\[6pt] &\text{C–F–E–C closes early} \\ &\quad \implies \text{cross out } \struck{\text{C–E}} \end{aligned}
Follow the chain reactionCrossing out B–D\struck{\text{B–D}} drops Dot D\text{D} to two available lines, locking in D–E\locked{\text{D–E}}. That gives Dot E\text{E} its two locked lines, so we cross out its extra line B–E\struck{\text{B–E}}.
Dot D has 2 lines left  ⟹  lock in D–E  ⟹  Dot E has 2 locked lines  ⟹  cross out B–E\displaystyle \begin{aligned} &\text{Dot D has } \quota{2} \text{ lines left} \\ &\quad \implies \text{lock in } \locked{\text{D–E}} \\ &\quad \implies \text{Dot E has } \quota{2} \text{ locked lines} \\ &\quad \implies \text{cross out } \struck{\text{B–E}} \end{aligned}
Close the circuitDots B\text{B} and C\text{C} now only have line B–C\text{B–C} left to reach two lines each, completing the loop around the outer ring.
A→B→C→F→E→D→A\displaystyle \circuit{\text{A} \to \text{B} \to \text{C} \to \text{F} \to \text{E} \to \text{D} \to \text{A}}

Locking in or crossing out one line triggers a chain reaction across the board, since crossing out extra lines or early loops drops other dots down to two available lines.

Locking in or ruling out a single road sets off a chain reaction that forces the rest of the circuit around the board.
2

Four Roadblocks That Rule Out a Circuit

When a graph has no Hamilton circuit at all, we want to spot what makes a loop impossible without testing every path by hand.

Four Roadblocks That Rule Out a Circuit
degree 1\text{degree }\htmlClass{lc-orange}{1}
3 forced lines\htmlClass{lc-orange}{3}\text{ forced lines}
c\htmlClass{lc-orange}{c}
cut vertex c\text{cut vertex }\htmlClass{lc-orange}{c}
5 Black≠4 White5\text{ Black}\htmlClass{lc-orange}{\neq}4\text{ White}
Text solution
Degree 1 dead endA dot with only one line gives a walk a way to enter, but no second line to leave without reusing that same line.
deg⁡(v)=1  ⟹  no Hamilton circuit(a Hamilton pathmust start or end at v)\displaystyle \begin{aligned} &\deg(v) = \fails{1} \\ &\quad \implies \text{no Hamilton circuit} \\ &\quad \text{(a Hamilton path} \\ &\quad \text{must start or end at } v\text{)} \end{aligned}
Three forced lines at one dotWhen three degree 2 dots all connect to the same central dot, they force three locked lines into a dot that can only use two.
3 forced lines at one dot>2  ⟹  no Hamilton circuit\displaystyle \fails{3} \text{ forced lines at one dot} > \quota{2} \implies \text{no Hamilton circuit}
Cut vertex bottleneckCrossing a single cut vertex from one part of the graph to the other leaves no way back to close the loop without visiting that middle dot a second time.
Cut vertex c  ⟹  no Hamilton circuit(a Hamilton pathcan cross c once)\displaystyle \begin{aligned} &\text{Cut vertex } \fails{c} \\ &\quad \implies \text{no Hamilton circuit} \\ &\quad \text{(a Hamilton path} \\ &\quad \text{can cross } \fails{c} \text{ once)} \end{aligned}
Bipartite color imbalanceColoring the 3-by-33\text{-by-}3 grid like a checkerboard gives 55 Black dots and 44 White dots, and since every step alternates colors, a 99-dot walk must start and end on Black with no line back to the Black start.
5 Black≠4 White  ⟹  path B–W–B–W–B–W–B–W–B works, but no Hamilton circuit\displaystyle \begin{aligned} &5\text{ Black} \fails{\neq} 4\text{ White} \implies \text{path } \\ &\quad \walk{\text{B–W–B–W–B–W–B–W–B}} \\ &\quad \text{ works, but no Hamilton circuit} \end{aligned}

On the 3-by-33\text{-by-}3 checkerboard grid, starting on White runs out of White dots after 8 dots, while starting on Black visits all 9 dots in a Hamilton path but ends on Black with no line back to the Black start.

Because every step on the 3-by-3 checkerboard grid switches colors, five Black dots and four White dots allow a Hamilton path from Black to Black, but never a closed circuit.
3

Guaranteeing a Circuit: Ore's and Dirac's Theorems

Now flip the question around: instead of looking for a roadblock that rules a circuit out, we want to know how many connections the dots need before a Hamilton circuit is guaranteed.

Guaranteeing a Circuit: Ore's and Dirac's Theorems
11
22
33
44
55
66
77
88
7 links, 7 pigeonholes\text{7 links, 7 pigeonholes}
Text solution
Pigeonhole crossover bridgeAlong a trapped chain of 88 dots with 77 links, each line from Dot 1\uEnd{1} to Dot k\uEnd{k} flags the right side of link (k−1)–k(k-1)\text{–}k and each line from Dot 8\vEnd{8} to Dot j\vEnd{j} flags the left side of link j–(j+1)j\text{–}(j+1), so 88 combined connections force at least one link to be flagged from both ends.
deg⁡(1)+deg⁡(8)≥8⏟8 connections (pigeons)across7 chain links⏟7 pigeonholes  ⟹  1→⋯→4→8→⋯→5→1\displaystyle \begin{aligned} &\underbrace{\uEnd{\deg(1)} + \vEnd{\deg(8)} \ge 8}_{8\text{ connections (pigeons)}} \quad \text{across} \\ &\underbrace{7\text{ chain links}}_{7\text{ pigeonholes}} \implies \\ &\circuit{1 \to \cdots \to 4} \vEnd{\to 8} \circuit{\to \cdots \to 5} \uEnd{\to 1} \end{aligned}
Ore's and Dirac's guarantees (n≥3n \ge 3)Requiring every pair of unconnected dots to have at least nn combined connections gives Ore's Theorem, and requiring every dot to have degree at least half of nn gives Dirac's Theorem.
Ore: deg⁡(u)+deg⁡(v)≥nfor all unconnected u,vDirac: deg⁡(v)≥n2 for all v\displaystyle \begin{aligned} \text{Ore: } &\uEnd{\deg(u)} + \vEnd{\deg(v)} \ge n \\ &\text{for all unconnected } \uEnd{u}, \vEnd{v} \\[6pt] \text{Dirac: } &\deg(v) \ge \frac{n}{2} \text{ for all } v \end{aligned}
Testing 66-dot graphs (n=6, so n2=3n = 6, \text{ so } \tfrac{n}{2} = 3)Graph 1 passes Dirac right away, Graph 2 fails Dirac because of a single degree 2\fails{2} dot but still passes Ore, and the 66-dot hexagon ring fails both theorems even though the ring itself is a Hamilton circuit.
All degrees 3 or 4:deg⁡(v)≥3  ⟹  Dirac guarantees a circuitFive 4s and one 2:2<3 (Dirac fails),2+4=6≥6  ⟹  Ore guarantees a circuitHexagon (all degrees 2):2<3 and 2+2=4<6  ⟹  both fail (no conclusion)\displaystyle \begin{aligned} &\text{All degrees } \passes{3}\text{ or }\passes{4}: \\ &\quad \deg(v) \ge 3 \\ &\quad \implies \text{Dirac guarantees a circuit} \\[8pt] &\text{Five } 4\text{s and one } \fails{2}: \\ &\quad \fails{2} < 3\text{ (Dirac fails)}, \\ &\quad \uEnd{2} + \vEnd{4} = \passes{6} \ge 6 \\ &\quad \implies \text{Ore guarantees a circuit} \\[8pt] &\text{Hexagon (all degrees } 2\text{)}: \\ &\quad \fails{2} < 3\text{ and } \\ &\quad \uEnd{2} + \vEnd{2} = \fails{4} < 6 \\ &\quad \implies \text{both fail (no conclusion)} \end{aligned}

Because the 7 chain links act as 7 pigeonholes, up to 7 arches from the endpoints can hit only one side of each link, while an 8th arch is forced to complete a crossover pair on some link and close the loop.

Interactive c3
4

The Traveling Salesperson Problem

In a complete graph where every city has a road to every other city, a Hamilton circuit is always guaranteed, so our goal becomes finding the Hamilton circuit with the lowest total cost.

The Traveling Salesperson Problem
A\text{A}
B\text{B}
C\text{C}
D\text{D}
Which Hamilton circuit is cheapest?\text{Which Hamilton circuit is cheapest?}
A\text{A}
B\text{B}
C\text{C}
D\text{D}
$10\$10
$12\$12
$13\$13
$14\$14
$15\$15
$30\htmlClass{lc-orange}{\$30}
Text solution
Count the distinct circuitsStarting from home leaves (n−1)!(n - 1)! ways to order the remaining stops, and dividing by 2\overcount{2} because traveling the same loop in reverse costs the exact same amount gives 3\howMany{3} distinct circuits on n=4n = 4 cities.
Distinct Hamilton circuits\displaystyle \text{Distinct Hamilton circuits} =(n−1)!2\displaystyle = \frac{(n - 1)!}{\overcount{2}} =(4−1)!2\displaystyle = \frac{(4 - 1)!}{\overcount{2}} =3×2×12\displaystyle = \frac{3 \times 2 \times 1}{\overcount{2}} =3\displaystyle = \howMany{3}
Brute ForcePricing all 3\howMany{3} loops from A\text{A} finds the guaranteed optimal route of $54\$54, which wins because skipping the cheap $10\$10 road A–B\text{A–B} avoids getting forced onto the $30\toll{\$30} road C–D\toll{\text{C–D}}.
A→B→C→D→A:$10+$12+$30+$15=$67A→B→D→C→A:$10+$14+$30+$13=$67A→C→B→D→A:$13+$12+$14+$15=$54 (optimal)\displaystyle \begin{aligned} &\walk{\text{A} \to \text{B} \to \text{C} \to \text{D} \to \text{A}}: \\ &\quad \$10 + \$12 + \toll{\$30} + \$15 = \$67 \\[6pt] &\walk{\text{A} \to \text{B} \to \text{D} \to \text{C} \to \text{A}}: \\ &\quad \$10 + \$14 + \toll{\$30} + \$13 = \$67 \\[6pt] &\walk{\text{A} \to \text{C} \to \text{B} \to \text{D} \to \text{A}}: \\ &\quad \$13 + \$12 + \$14 + \$15 \\ &\quad = \$54 \text{ (optimal)} \end{aligned}
Nearest Neighbor from A\text{A}Always taking the cheapest road from the current city picks A–B\walk{\text{A–B}} ($10\$10) and B–C\walk{\text{B–C}} ($12\$12), leaving D\text{D} as the only unvisited city and forcing the $30\toll{\$30} road C–D\toll{\text{C–D}} before returning on D–A\walk{\text{D–A}} ($15\$15).
A→$10B→$12C→$30 (forced)D→$15A  ⟹  Total=$67\displaystyle \begin{aligned} &\walk{\text{A} \xrightarrow{\$10} \text{B} \xrightarrow{\$12} \text{C}} \toll{\xrightarrow{\$30\text{ (forced)}}} \\ &\quad \walk{\text{D} \xrightarrow{\$15} \text{A}} \implies \text{Total} = \$67 \end{aligned}
Sorted EdgesScanning all roads from cheapest to most expensive keeps A–B\locked{\text{A–B}} ($10\$10) and B–C\locked{\text{B–C}} ($12\$12), skips A–C\struck{\text{A–C}} ($13\$13, closes A–B–C–A\text{A–B–C–A} early) and B–D\struck{\text{B–D}} ($14\$14, third line at B\text{B}), and finishes with A–D\locked{\text{A–D}} ($15\$15) and C–D\locked{\text{C–D}} ($30\toll{\$30}) for the same loop A→B→C→D→A\walk{\text{A} \to \text{B} \to \text{C} \to \text{D} \to \text{A}}.
$10 (A–B)+$12 (B–C)+$13 (early loop)+$14 (3rd at B)+$15 (A–D)+$30 (C–D)=$67\displaystyle \begin{aligned} &\quad \locked{\$10\text{ (A–B)}} \\ &+ \locked{\$12\text{ (B–C)}} \\ &+ \struck{\cancel{\$13\text{ (early loop)}}} \\ &+ \struck{\cancel{\$14\text{ (3rd at B)}}} \\ &+ \locked{\$15\text{ (A–D)}} \\ &+ \toll{\$30}\locked{\text{ (C–D)}} \\ &= \$67 \end{aligned}

Key concepts

Before starting, check whether the problem asks to cover every line once (an Euler problem, where for a connected graph you simply check for even degrees and use every line on the board) or visit every dot once (a Hamilton problem, where every dot in a finished circuit uses exactly 2\quota{2} lines and all other lines are left unused).

Finding or ruling out a circuit on a specific graph

Lock in both lines on any degree 2\quota{2} dot (deg⁡(A)=2\deg(\text{A}) = \quota{2}   ⟹  \implies lock in both\text{lock in both}), cross out remaining lines on any dot that reaches 2\quota{2} locked lines, and cross out any line that would close an early loop of fewer than nn dots (such as A–B–D–A\text{A–B–D–A} on a 66-dot graph). If you spot a degree 1\fails{1} dead end, 3\fails{3} forced lines meeting at one dot, a cut vertex, or a bipartite graph with unequal color counts (like 55 Black and 44 White dots on a 3-by-33\text{-by-}3 grid), a Hamilton circuit is impossible, though a Hamilton path can still start at a degree 1\fails{1} dot, cross a cut vertex once, or alternate B–W–B…B\walk{\text{B–W–B}\dots\text{B}} when the color counts differ by 11.

Testing degree guarantees (n≥3n \ge 3)

Check Dirac's Theorem first (deg⁡(v)≥n2\deg(v) \ge \tfrac{n}{2} for every dot, such as all degrees ≥4\ge 4 when n=8n = 8). If a few low-degree dots fail Dirac, check Ore's Theorem (deg⁡(u)+deg⁡(v)≥n\uEnd{\deg(u)} + \vEnd{\deg(v)} \ge n for every unconnected pair u,v\uEnd{u}, \vEnd{v}). If either passes, a Hamilton circuit is guaranteed; if both fail (as on a plain 66-dot ring where 2+2<6\uEnd{2} + \vEnd{2} < 6), draw no conclusion and inspect the graph directly.

Finding a low-cost circuit on a complete graph

A complete graph on nn cities has (n−1)!2\frac{(n - 1)!}{\overcount{2}} distinct Hamilton circuits (so n=4n = 4 has 3!2=3\tfrac{3!}{\overcount{2}} = \howMany{3} loops). Use Brute Force on small graphs to guarantee the lowest-cost circuit, Nearest Neighbor to always step to the cheapest unvisited city from where you stand, and Sorted Edges to pick the cheapest roads across the whole map while skipping early loops and third lines at any dot.

5

Practice

1

A 6-dot graph has dots A, B, C, D, E,\text{A, B, C, D, E,} and F\text{F} with 9 lines: an outer ring A–B–C–D–E–F–A\text{A–B–C–D–E–F–A} and three interior lines B–F\text{B–F}, C–E\text{C–E}, and B–E\text{B–E}. Use the three deduction rules (locking in degree 2 dots, preventing early loops, and crossing out extra lines on dots with two locked lines) to determine which interior lines must be crossed out and find the Hamilton circuit.

A\text{A}
B\text{B}
C\text{C}
D\text{D}
E\text{E}
F\text{F}

Which two dots on the outer ring have no interior lines touching them, so their degree is already 2\quota{2}?

First, Dots A\text{A} and D\text{D} each have degree 2\quota{2}, so lock in A–B\locked{\text{A–B}}, A–F\locked{\text{A–F}}, C–D\locked{\text{C–D}}, and D–E\locked{\text{D–E}} (Rule 1). Next, using B–F\struck{\text{B–F}} would close the 3-dot loop A–B–F–A\text{A–B–F–A} early and using C–E\struck{\text{C–E}} would close C–D–E–C\text{C–D–E–C} early, so cross out B–F\struck{\text{B–F}} and C–E\struck{\text{C–E}} (Rule 3). (Watch out: don't lock in the center line B–E\struck{\text{B–E}} before checking what crossing out B–F\struck{\text{B–F}} and C–E\struck{\text{C–E}} does to Dots F\text{F} and C\text{C}. Taking B–E\struck{\text{B–E}} would close the 4-dot loop A–B–E–F–A\text{A–B–E–F–A} or leave C\text{C} and F\text{F} stranded.) Crossing out B–F\struck{\text{B–F}} and C–E\struck{\text{C–E}} leaves Dot F\text{F} with only A–F\locked{\text{A–F}} and E–F\locked{\text{E–F}} and Dot C\text{C} with only B–C\locked{\text{B–C}} and C–D\locked{\text{C–D}}, so lock in E–F\locked{\text{E–F}} and B–C\locked{\text{B–C}} (Rule 1). Now Dots B\text{B} and E\text{E} each have two locked lines, so cross out B–E\struck{\text{B–E}} (Rule 2). The unique Hamilton circuit is A→B→C→D→E→F→A\circuit{\text{A} \to \text{B} \to \text{C} \to \text{D} \to \text{E} \to \text{F} \to \text{A}} (or its reverse).
2

A 6-dot graph is made of two triangles A–B–C–A\text{A–B–C–A} and C–D–E–C\text{C–D–E–C} meeting at Dot C\text{C}, plus a sixth dot F\text{F} attached only to Dot A\text{A} by a single line A–F\text{A–F}. Explain two distinct reasons why this graph has no Hamilton circuit, then determine whether it has a Hamilton path.

Check the degree of Dot F\text{F} and what happens to the graph if you remove Dot C\text{C} (or Dot A\text{A}).

It has no Hamilton circuit because Dot F\text{F} has degree 1\fails{1} (you cannot enter and leave F\text{F} without reusing line A–F\text{A–F}) and because Dot C\fails{\text{C}} (as well as Dot A\fails{\text{A}}) is a cut vertex (crossing from one triangle to the other leaves no way back to close the loop without visiting the cut vertex twice). (Watch out: when testing for a Hamilton path, starting at B\text{B} and walking B→A→F\walk{\text{B} \to \text{A} \to \text{F}} traps you at the dead end F\text{F} after two steps and makes it look like no Hamilton path exists. Any Hamilton path must start or end at the degree 1\fails{1} dot F\text{F}.) Starting at the dead end F\text{F} and crossing C\fails{\text{C}} once gives the Hamilton path F→A→B→C→D→E\walk{\text{F} \to \text{A} \to \text{B} \to \text{C} \to \text{D} \to \text{E}}.
3

In the 3-by-33\text{-by-}3 grid of 9 dots (colored like a checkerboard with 5 Black dots at the corners and center, and 4 White dots), suppose we delete a single dot and its lines to leave an 8-dot graph. (a) If we delete the center Black dot, does the remaining 8-dot graph have a Hamilton circuit? (b) If instead we delete one White dot, can the remaining 8-dot graph have a Hamilton circuit or even a Hamilton path?

Count how many Black and White dots remain in each 8-dot graph, and check how many Black dots can fit in an alternating B–W–B–W…\walk{\text{B–W–B–W}\dots} sequence with that many White dots.

(a) Deleting the center Black dot leaves 44 Black and 44 White dots forming the outer 8-dot ring, which is a Hamilton circuit. (b) Deleting a White dot leaves 55 Black dots and 33 White dots. (Watch out: don't assume that starting and ending on Black always gives a Hamilton path in an uneven bipartite graph. That can only work when the color counts differ by 11, not 5−3=25 - 3 = \fails{2}.) Because every step in a bipartite graph must alternate colors (B–W–B–W…\walk{\text{B–W–B–W}\dots}), 33 White dots can sit between at most 44 Black dots (at most 77 dots total, B–W–B–W–B–W–B\walk{\text{B–W–B–W–B–W–B}}), so neither a Hamilton circuit nor a Hamilton path is possible.
4

Suppose you have traced a trapped chain of 8 dots, 1–2–3–4–5–6–7–81\text{–}2\text{–}3\text{–}4\text{–}5\text{–}6\text{–}7\text{–}8, with no line directly between Dot 1 and Dot 8. If Dot 1 connects to Dots 2,3,6,\uEnd{2, 3, 6,} and 7\uEnd{7}, and Dot 8 connects to Dots 3,4,5,\vEnd{3, 4, 5,} and 7\vEnd{7}, which of the 7 links in the chain gives a crossover bridge, and what Hamilton circuit does it produce?

A connection from Dot 1 to Dot k\uEnd{k} flags the right side of link (k−1)–k(k-1)\text{–}k, while a connection from Dot 8 to Dot j\vEnd{j} flags the left side of link j–(j+1)j\text{–}(j+1).

Dot 1's connections to 2,3,6,7\uEnd{2, 3, 6, 7} flag the right side of links 1–2,2–3,5–6,1\text{–}2, 2\text{–}3, \crossover{5\text{–}6}, and 6–76\text{–}7, while Dot 8's connections to 3,4,5,7\vEnd{3, 4, 5, 7} flag the left side of links 3–4,4–5,5–6,3\text{–}4, 4\text{–}5, \crossover{5\text{–}6}, and 7–87\text{–}8. (Watch out: don't match the shared target Dot 77 just because both endpoints connect to 77. Jumping 1→⋯→7→81 \to \cdots \to 7 \fails{\to 8} strands the dots in between instead of bridging across a single chain link.) Both endpoints hit link 5–6\crossover{5\text{–}6} (Dot 1 connects to 6\uEnd{6} and Dot 8 connects to 5\vEnd{5}), giving the Hamilton circuit 1→2→3→4→5→8→7→6→1\circuit{1 \to 2 \to 3 \to 4 \to 5} \vEnd{\to 8} \circuit{\to 7 \to 6} \uEnd{\to 1}.
5

A connected graph with n=8n = 8 dots has vertex degrees 3,4,4,5,5,5,6,3, 4, 4, 5, 5, 5, 6, and 66, and the single dot of degree 33 is already connected by a line to both dots of degree 44. Does Dirac's Theorem guarantee a Hamilton circuit? Does Ore's Theorem guarantee one? If a different 8-dot graph fails both theorems, what can you conclude?

For Ore's Theorem, you only add deg⁡(u)+deg⁡(v)\uEnd{\deg(u)} + \vEnd{\deg(v)} for pairs of dots that are not connected to each other.

Dirac's Theorem requires every dot to have degree at least n2=4\tfrac{n}{2} = 4, so it fails because of the degree 3\fails{3} dot. (Watch out: for Ore's Theorem, don't just add the two smallest numbers on the list, 3+4=7<83 + 4 = \fails{7} < 8, and say it fails. The degree 33 dot is already connected to both degree 44 dots, and Ore's Theorem only checks unconnected pairs.) Since the degree 33 dot is already connected to both degree 44 dots, any dot not connected to it has degree at least 55 (giving 3+5=8≥8\uEnd{3} + \vEnd{5} = \passes{8} \ge 8), and any two other unconnected dots have degrees at least 44 and 44 (giving 4+4=8≥8\uEnd{4} + \vEnd{4} = \passes{8} \ge 8). Thus Ore's Theorem passes and guarantees a Hamilton circuit. Failing both theorems on another graph gives no conclusion (not "no circuit exists"), since Dirac and Ore are one-way guarantees.
6

How many distinct Hamilton circuits does a complete graph on 6 cities have? Then, on the 4-city complete graph with road prices A–B $10\text{A–B } \$10, B–D $14\text{B–D } \$14, A–D $15\text{A–D } \$15, B–C $18\text{B–C } \$18, A–C $20\text{A–C } \$20, and C–D $40\text{C–D } \$40, find the circuits and total costs given by Brute Force, Nearest Neighbor starting at A\text{A}, and Sorted Edges.

For 6 cities, remember that reversing a loop uses the exact same roads; for Sorted Edges on the 4-city map, check each road in price order against the early-loop and two-lines-per-dot rules.

A 6-city complete graph has (6−1)!2=5!2=1202=60\tfrac{(6 - 1)!}{\overcount{2}} = \tfrac{5!}{\overcount{2}} = \tfrac{120}{\overcount{2}} = \howMany{60} distinct Hamilton circuits (watch out: forgetting to divide by 2\overcount{2} gives 120\fails{120}, and using 6!2\tfrac{6!}{\overcount{2}} instead of (6−1)!2\tfrac{(6 - 1)!}{\overcount{2}} gives 360\fails{360}).
On the 4-city map, Brute Force checks all 3!2=3\tfrac{3!}{\overcount{2}} = \howMany{3} loops:
A→B→D→C→A\walk{\text{A} \to \text{B} \to \text{D} \to \text{C} \to \text{A}}: $10+$14+$40+$20=$84\$10 + \$14 + \toll{\$40} + \$20 = \$84
A→B→C→D→A\walk{\text{A} \to \text{B} \to \text{C} \to \text{D} \to \text{A}}: $10+$18+$40+$15=$83\$10 + \$18 + \toll{\$40} + \$15 = \$83
A→C→B→D→A\walk{\text{A} \to \text{C} \to \text{B} \to \text{D} \to \text{A}}: $20+$18+$14+$15=$67\$20 + \$18 + \$14 + \$15 = \$67 (optimal route)
Nearest Neighbor from A\text{A} takes A→B\walk{\text{A} \to \text{B}} ($10\$10), then B→D\walk{\text{B} \to \text{D}} ($14\$14), and is forced onto D→C\toll{\text{D} \to \text{C}} ($40\toll{\$40}) and C→A\walk{\text{C} \to \text{A}} ($20\$20) for $84\$84.
Sorted Edges keeps A–B\locked{\text{A–B}} ($10\$10) and B–D\locked{\text{B–D}} ($14\$14), skips A–D\struck{\text{A–D}} ($15\$15, closes early loop A–B–D–A\text{A–B–D–A}; watch out: keeping $15\$15 here would trap the walk into a 3-city triangle and give a false total), skips B–C\struck{\text{B–C}} ($18\$18, third line at B\text{B}), and keeps A–C\locked{\text{A–C}} ($20\$20) and C–D\locked{\text{C–D}} ($40\toll{\$40}), also giving A→B→D→C→A\walk{\text{A} \to \text{B} \to \text{D} \to \text{C} \to \text{A}} for $84\$84.