8.3 Hamiltonian Cycles and the TravelingSalesman Problem
The Icosian Game
The puzzleCan you determine a route along the edges of the graph that begins atsome vertex and then returns there after having visited every othervertex exactly once?
Definitions
DefinitionA Hamiltonian path is a path that visits each vertex once.
DefinitionA Hamiltonian cycle (or circuit) is a closed path that visits each vertexonce.
DefinitionA graph that has a Hamiltonian cycle is called Hamiltonian.
Definitions
DefinitionA Hamiltonian path is a path that visits each vertex once.
DefinitionA Hamiltonian cycle (or circuit) is a closed path that visits each vertexonce.
DefinitionA graph that has a Hamiltonian cycle is called Hamiltonian.
Definitions
DefinitionA Hamiltonian path is a path that visits each vertex once.
DefinitionA Hamiltonian cycle (or circuit) is a closed path that visits each vertexonce.
DefinitionA graph that has a Hamiltonian cycle is called Hamiltonian.
Which are Hamiltonian?
Of the following, which have Hamiltonian cycles? Hamiltonianpaths?
Showing a Graph is Not Hamiltonian
Rules:
1 If a vertex v has degree 2, then both of its incident edges must bepart of any Hamiltonian cycle.
2 During the construction of a Hamiltonian cycle, no cycle can beformed until all of the vertices have been visited.
3 If during the construction of a Hamiltonian cycle two of theedges incident to a vertex v are required, then all other incidentedges can be deleted.
GoalTo begin a construction of a Hamiltonian cycle and show at somepoint during the construction that it is impossible to proceed anyfurther.
Showing a Graph is Not Hamiltonian
Rules:
1 If a vertex v has degree 2, then both of its incident edges must bepart of any Hamiltonian cycle.
2 During the construction of a Hamiltonian cycle, no cycle can beformed until all of the vertices have been visited.
3 If during the construction of a Hamiltonian cycle two of theedges incident to a vertex v are required, then all other incidentedges can be deleted.
GoalTo begin a construction of a Hamiltonian cycle and show at somepoint during the construction that it is impossible to proceed anyfurther.
Example
Is the given graph G Hamiltonian?
a• •b •c
v• •w •x
d• •e •f
Solution
First apply rule 1 to vertices v,w and x
a• •b •c
v• •w •x
d• •e •f
Solution (cont.)
Now apply rule 1 and 3 to vertex b
a• •b x •c
v• •w •x
d• •e •f
Solution (cont.)
Now apply rule 3 to vertex a
a•x
•b x •c
v• •w •x
d• •e •f
Now, there is only one edge incident to c and by rule 1 noHamiltonian cycle can exist.
Another Example
Is the following graph Hamiltonian?
a• b• •c
•v w•
d• e• •f
Sufficiency Conditions
TheoremOre’s Theorem(1960) Suppose that G is a graph with n ≥ 3 verticesand for all distinct nonadjacent vertices x and y,
deg(x) + deg(y) ≥ n
The G has a Hamiltonian circuit.
Proof Suppose that G has no Hamiltonian cycle. We will show thatfor some nonadjacent vertices x, y ∈ V(G),
degG(x) + degG(y) < n (∗)
where degG(a) means the degree of a in G.
Sufficiency Conditions
TheoremOre’s Theorem(1960) Suppose that G is a graph with n ≥ 3 verticesand for all distinct nonadjacent vertices x and y,
deg(x) + deg(y) ≥ n
The G has a Hamiltonian circuit.
Proof Suppose that G has no Hamiltonian cycle. We will show thatfor some nonadjacent vertices x, y ∈ V(G),
degG(x) + degG(y) < n (∗)
where degG(a) means the degree of a in G.
Proof of Ore’s Theorem (cont.)
If we add edges to G, we eventually obtain a complete graph, whichhas a Hamiltonian circuit. Thus, in the process of adding edges, wemust eventually hit a graph H with the property that H has noHamiltonian cycle but adding any more edges to H gives us a graphwith a Hamiltonian cycle. We will show that in H, there arenonadjacent x and y so that
degH(x) + degH(y) < n (∗∗)
But degG(a) ≤ degH(a) for all a, so (∗∗) implies (∗).
Pick any nonadjacent vertices x and y in H. Then H plus the edge{x, y} has a Hamiltonian cycle. Since H does not, this cycle must usethe edge {x, y}. Hence, it can be written as
x, y, a1, a2, . . . , an−2, x
Proof of Ore’s Theorem (cont.)
If we add edges to G, we eventually obtain a complete graph, whichhas a Hamiltonian circuit. Thus, in the process of adding edges, wemust eventually hit a graph H with the property that H has noHamiltonian cycle but adding any more edges to H gives us a graphwith a Hamiltonian cycle. We will show that in H, there arenonadjacent x and y so that
degH(x) + degH(y) < n (∗∗)
But degG(a) ≤ degH(a) for all a, so (∗∗) implies (∗).
Pick any nonadjacent vertices x and y in H. Then H plus the edge{x, y} has a Hamiltonian cycle. Since H does not, this cycle must usethe edge {x, y}. Hence, it can be written as
x, y, a1, a2, . . . , an−2, x
Proof of Ore’s Theorem (cont.)
•y •a1 •a2 . . . •ai−1 •ai •ai+1 . . . •an−2 •x
Now, V(H) = {x, y, a1, a2, . . . , an−2}. Moreover, we note that fori > 1,
{y, ai} ∈ E(H)⇒ {x, ai−1} 6∈ E(H) (∗ ∗ ∗)For if not, then
y, ai, ai+1, . . . , an−2, x, ai−1, ai−2, . . . , a1, y
is a Hamiltonian cycle in H, which is a contradiction. So, (∗ ∗ ∗) and{x, y} 6∈ E(H) imply (∗∗).
•y •a1 •a2 . . . •ai−1 •ai •ai+1 . . . •an−2 •x
//
Proof of Ore’s Theorem (cont.)
•y •a1 •a2 . . . •ai−1 •ai •ai+1 . . . •an−2 •x
Now, V(H) = {x, y, a1, a2, . . . , an−2}. Moreover, we note that fori > 1,
{y, ai} ∈ E(H)⇒ {x, ai−1} 6∈ E(H) (∗ ∗ ∗)For if not, then
y, ai, ai+1, . . . , an−2, x, ai−1, ai−2, . . . , a1, y
is a Hamiltonian cycle in H, which is a contradiction. So, (∗ ∗ ∗) and{x, y} 6∈ E(H) imply (∗∗).
•y •a1 •a2 . . . •ai−1 •ai •ai+1 . . . •an−2 •x
//
Consequence
CorollaryDirac(1952) Suppose that G is a graph with n ≥ 3 vertices and eachvertex has degree at least n
2 . The G has a Hamiltonian cycle.
Why are we not proving this?
Construction of a Hamiltonian Cycle
We will use this graph to illustrate the construction.
y1• •y2
y5• •y6
y4• •y3
The Construction
Step 1Start with any vertex and construct the longest path you can.
γ : y1 − y2 − y3 − y4
y1• •y2
y5• •y6
y4• •y3
Construction(cont.)
Step 2Check to see if y1 and ym are adjacent.a) If y1 and ym are not adjacent, go to (3). Else y1 and ym are adjacentand go to (b).b) If m = n, stop and the output is a Hamiltonian cycle.
γ : y1 − y2 − y3 − y4 − y1
c) Locate a vertex z not on γ and a vertex yk on γ such that z isadjacent to yk. Replace γ with a path of length m + 1 given by
z− yk − . . .− ym − y1 . . .− yk−1
and go back to (2).
Construction(cont.)
y1• •y2
y5• •z
y4• •y3
γ : z− y3 − y4 − y1 − y2
Step 3Locate a vertex yk with 1 < k < m such that y1 and yk are adjacentand yk−1 and ym are adjacent. Replace γ with the path
γ : y1 − . . .− yk−1 − ym − . . .− yk
The two ends of the path, namely y1 and yk, are adjacent, and go backto (2)(b).
Construction(cont.)
After renumbering, we now we return to (2)
y4• •y5
z• •y1
y3• •y2
z− y4 − y5 − y1 − y2 − y3
and then renumber
y2• •y3
y1• •y4
y6• •y5
Construction(cont.)
After renumbering, we now we return to (2)
y4• •y5
z• •y1
y3• •y2
z− y4 − y5 − y1 − y2 − y3
and then renumber
y2• •y3
y1• •y4
y6• •y5
Construction(cont.)
When we return to (2), we have the m = 6, so when we add the finaledge to return to start, we have completed the cycle.
y2• •y3
y1• •y4
y6• •y5
The Knight’s Tour Problem
The knight’s tour problem involves the knight graph, which is a graphon vertices in which each vertex represents a square in an chessboard,and each edge corresponds to a legal move by a knight. The process isthis: begin with a square on the grid and and travel around the boardusing only ‘L’ shaped moves.
KK
K
DefinitionA knight’s tour is a sequence of moves by a knight such that eachsquare of the board is visited exactly once. It is therefore aHamiltonian path on the corresponding knight graph.
The Knight’s Tour Problem
The knight’s tour problem involves the knight graph, which is a graphon vertices in which each vertex represents a square in an chessboard,and each edge corresponds to a legal move by a knight. The process isthis: begin with a square on the grid and and travel around the boardusing only ‘L’ shaped moves.
KK
K
DefinitionA knight’s tour is a sequence of moves by a knight such that eachsquare of the board is visited exactly once. It is therefore aHamiltonian path on the corresponding knight graph.
When do knight’s tours exist?
ExampleDoes a knight’s tour exist for a 3× 3 board?
Consider the following board:
K
Where do we go from here?What if we started here?
K
When do knight’s tours exist?
ExampleDoes a knight’s tour exist for a 3× 3 board?
Consider the following board:
K
Where do we go from here?
What if we started here?
K
When do knight’s tours exist?
ExampleDoes a knight’s tour exist for a 3× 3 board?
Consider the following board:
K
Where do we go from here?What if we started here?
K
Knight’s Tours and Hamiltonian Graphs
Knight’s Tour
5 8 32 67 4 1
This corresponds to the graph:
1• •2
3• •4
5• •6
7• •8
9•
We could invoke one last theorem ...
Knight’s Tours and Hamiltonian Graphs
Knight’s Tour
5 8 32 67 4 1
This corresponds to the graph:
1• •2
3• •4
5• •6
7• •8
9•
We could invoke one last theorem ...
Knight’s Tours and Hamiltonian Graphs
Knight’s Tour
5 8 32 67 4 1
This corresponds to the graph:
1• •2
3• •4
5• •6
7• •8
9•
We could invoke one last theorem ...
Justification for 3× 3 board
TheoremLet G be a bipartite graph with bipartition (X,Y).
1 If |X| 6= |Y|, then G does not have a Hamiltonian cycle.2 If |X| = |Y|, then G does not have a Hamiltonian path that
begins at a vertex in X and ends at a vertex in X.3 If |X| and |Y| differ by at least 2, then G does not have a
Hamiltonian path.4 If |X| = |Y|+ 1, then G does not have a Hamiltonian path that
begins at a vertex in X and ends at a vertex of Y, and vice versa.
The Traveling Salesman Problem
The ProblemGiven a graph G with weighted edges, find a minimal Hamiltoniancycle.
So, this is analagous to finding a Hamiltonian cycle, but we heed tofactor in the weights to minimize the ‘cost’ associated with the edgestraversed.
The Traveling Salesman Problem
The ProblemGiven a graph G with weighted edges, find a minimal Hamiltoniancycle.
So, this is analagous to finding a Hamiltonian cycle, but we heed tofactor in the weights to minimize the ‘cost’ associated with the edgestraversed.
TSP Example
ExampleFind the minimal Hamiltonian cycle for the given graph.
B• 6
33
D• 2
2
H•
6
A•2•C
5
5
•E
43
•F 4•G
Solution: A− B− D− H − G− E − F − C − A
TSP Example
ExampleFind the minimal Hamiltonian cycle for the given graph.
B• 6
33
D• 2
2
H•
6
A•2•C
5
5
•E
43
•F 4•G
Solution: A− B− D− H − G− E − F − C − A
Top Related