Contemporary Mathematics

# 12.7Hamilton Cycles

Contemporary Mathematics12.7 Hamilton Cycles

Figure 12.155 The symmetries of an icosahedron, with 30 edges, 20 faces, and 12 vertices, can be analyzed using graph theory. (credit: "Really big icosahedron" by Clayton Shonkwiler/Wikimedia, CC BY 2.0)

## Learning Objectives

After completing this section, you should be able to:

1. Describe and identify Hamilton cycles.
2. Compute the number of Hamilton cycles in a complete graph.
3. Apply and evaluate weighted graphs.

In Euler Circuits and Euler Trails, we looked for circuits and paths that visited each edge of a graph exactly once. In this section, we will look for circuits that visit each vertex exactly once. Like many concepts in graph theory, the idea of a circuit that visits each vertex once was inspired by games and puzzles. As early as the 9th century, Indian and Islamic intellectuals wondered whether it was possible for a knight to visit every space on a chess board of a given size, which is equivalent to visiting every vertex of a graph that represents the chess board.

In 1857, a mathematician named William Rowan Hamilton invented a puzzle in which players were asked to find a route along the edges of a dodecahedron (see Figure 12.156), which visited every vertex exactly once. Let’s explore how graph theory provides insight into these games as well as practical applications such as the Traveling Salesperson Problem.

Figure 12.156 A Dodecahedron

## Hamilton’s Puzzle

Before we look at the solution to Hamilton's puzzle, let’s review some vocabulary we used in Figure 12.157. It will be helpful to remember that directed cycle is a type of circuit that doesn’t repeat any edges or vertices.

Figure 12.157 Closed Walks, Circuits, and Directed Cycles

The goal of Hamilton's puzzle was to find a route along the edges of the dodecahedron, which visits each vertex exactly once. A dodecahedron is a three-dimensional space figure with faces that are all pentagons as we saw in Figure 12.156.

Since it is easier to visualize two dimensions rather than three, we will flatten out the dodecahedron and look at the edges and vertices on a flat surface. Graph A in Figure 12.158 shows a two-dimensional graph of the edges and vertices, and Graph B shows an untangled version of Graph A in which no edges are crossing. Graph B in Figure 12.158 is very similar to the design of the game board that Hamilton invented for his puzzle.

Figure 12.158 Graph of Edges and Vertices of Dodecahedron

We can see that this is a planar graph because it can be “untangled.” In order to solve Hamilton’s puzzle, we need to find a circuit that visits every vertex once. A solution is shown in Figure 12.159.

Figure 12.159 A Solution to Hamilton’s Puzzle

A circuit that doesn’t repeat any vertices, like the one in Figure 12.159, is called a directed cycle. So, we can most accurately say that Hamilton’s puzzle asks us to find a directed cycle that visits every vertex in a graph exactly once. Because Hamilton created and solved this puzzle, these special circuits were named Hamilton cycles, or Hamilton circuits.

## Who Knew?

### Icosian Game

When Hamilton invented his puzzle in the 19th century, it was originally called the Icosian game. This was a reference to an icosahedron, not a dodecahedron. Why? Hamilton was actually interested in the symmetries of icosahedrons. It turns out that these two space figures are related to each other. The dodecahedron has 30 edges, 20 faces, and 12 vertices, while the icosahedron has 30 edges, 12 faces, and 20 vertices. By relating the vertices of the dodecahedron to the faces of the icosahedron, Hamilton was able to make the mathematical connections necessary to use graph theory and dodecahedrons to make discoveries about the symmetries of icosahedrons.

## Hamilton Cycles vs. Euler Circuits

Let’s practice naming and identifying Hamilton cycles, as well as distinguishing them from Euler circuits. It is important to remember that Euler circuits visit all edges without repetition, while Hamilton cycles visit all vertices without repetition. Hamilton cycles are named by their vertices just like all circuits. An example is given in Figure 12.160.

Figure 12.160 Hamilton Cycle in Graph Z

Notice that the Hamilton cycle abcd for Graph Z in Figure 12.160 is NOT an Euler circuit, because it does not visit edge $acac$. Some Hamilton cycles are also Euler circuits while some are not, and some Euler circuits are Hamilton cycles while some are not.

## Checkpoint

TIP! Sometimes students confuse Euler circuits with Hamilton cycles. To help you remember, think of the E in Euler as standing for Edge.

## Example 12.33

### Differentiating between Hamilton Cycles or Euler Circuits

Use Figure 12.161 to determine whether the given circuit is a Hamilton cycle, an Euler circuit, both, or neither.

Figure 12.161 Graph Q
1. abcehgfda
2. gehgfdabdg
3. abcehgfdbegda

## Checkpoint

TIP! Euler circuits never skip a vertex, so, they only fail to be Hamilton cycles when they visit a vertex more than once. Hamilton cycles never visit any edges twice, so, they only fail to be Euler circuits when they skip edges.

1.
Consider the figure shown. Is the circuit abfehigdca an Euler circuit, a Hamilton cycle, or both?
Graph T

Notice that the graph is a cycle. A cycle will always be Eulerian because all vertices are degree 2. Moreover, any circuit in the graph will always be both an Euler circuit and a Hamilton cycle. It is not always as easy to determine if a graph has a Hamilton cycle as it is to see that it has an Euler circuit, but there is a large group of graphs that we know will always have Hamilton cycles, the complete graphs. Since all vertices in a complete graph are adjacent, we can always find a directed cycle that visits all the vertices. For example, look at the directed six-cycle, nopqrs, in the complete graph with six vertices in Figure 12.162.

Figure 12.162 Directed Cycle in Complete Graph

That is not the only directed six-cycle in the graph though. We could find another just be reversing the direction, and we could find even more by using different edges. So, how many Hamilton cycles are in a complete graph with $nn$ vertices? Before we tackle this problem, let’s look at a shorthand notation that we use in mathematics which will be helpful to us.

## Factorials

In many areas of mathematics, we must calculate products like $7⋅6⋅5⋅4⋅3⋅2⋅17⋅6⋅5⋅4⋅3⋅2⋅1$ or $11⋅10⋅9⋅8⋅7⋅6⋅5⋅4⋅3⋅2⋅111⋅10⋅9⋅8⋅7⋅6⋅5⋅4⋅3⋅2⋅1$, products that involve multiplying all the counting numbers from a particular number down to 1. Imagine that the product happened to be all the numbers from 100 down to 1. That’s a lot of writing! Instead of writing all of that out, mathematicians came up with a shorthand notation. For example, instead of $7⋅6⋅5⋅4⋅3⋅2⋅17⋅6⋅5⋅4⋅3⋅2⋅1$, we write $7!7!$, which is read “7 factorial.” In other words, the product of all the counting numbers from $nn$ down to 1 is called $nn$ factorial and it is written $n!n!$

## Example 12.34

### Evaluating Factorials

Evaluate $n!n!$ and $(n−1)!(n−1)!$ for $n=4n=4$.

1.
Evaluate $n!$ and $(n - 1)!$ for $n = 6$.

A common use for factorials is counting the number of ways to arrange objects. Suppose that there were three students, Aryana, Byron, and Carlos, who wanted to line up in a row. How many arrangements are possible? There are six possibilities: ABC, ACB, BAC, BCA, CAB, or CBA. Notice that there were three students being arranged, and the number of possible arrangements is three.

## FORMULA

The number of ways to arrange $nn$ distinct objects is $n!n!$.

## Example 12.35

### Counting Arrangements of Letters

Find the number of ways to arrange the letters a, b, c, and d.

1.
Find the number of ways to arrange the letters v, w, x, y, and z.

## Counting Hamilton Cycles in Complete Graphs

Now, let’s get back to answering the question of how many Hamilton cycles are in a complete graph. In Table 12.8, we have drawn all the four cycles in a complete graph with four vertices. Remember, cycles can be named starting with any vertex in the cycle, but we will name them starting with vertex $aa$.

Complete Graph Cycle Cycle Cycle
Cycle Name Clockwise (a, b, c, d) (a, b, d, c) (a, c, b, d)
Cycle Name Counterclockwise (a, d, c, b) (a, c, d, b) (a, d, b, c)
Table 12.8 Four-Cycles in Complete Graph with Four Vertices

Table 12.8 shows that there are three unique four-cycles in a complete graph with four vertices. Notice that there were two ways to name each cycle, one reading the vertices in a clockwise direction and one reading the vertices in a counterclockwise direction. This is important to us because we are interested in Hamilton cycles, which are directed cycles. Although the cycles (a, b, c, d) and (a, d, c, b) are the same cycle, the directed cycles, abcda and adcba, which travel the same route in reverse order are considered different directed cycles, as shown in Table 12.9.

Complete Graph Cycle Cycle Cycle
Clockwise Hamilton Cycle

abcda

abdca

acbda

Counter-clockwise Hamilton Cycle

acdba

Table 12.9 Hamilton Cycles in a Complete Graph with Four Vertices

The six directed four-cycles in Table 12.9 are the only distinct Hamilton cycles in a complete graph with four vertices. Six is also the number of ways to arrange the three letters b, c, and d. (Do you see why?) The number of ways to arrange three letters is $3!=3⋅2⋅1=63!=3⋅2⋅1=6$. Similarly, the number of Hamilton cycles in a graph with five vertices is the number of ways to arrange four letters, which is $4!=4⋅3⋅2⋅1=244!=4⋅3⋅2⋅1=24$. In general, to find the number of Hamilton cycles in a graph, we take one less than the number of vertices and find its factorial.

## FORMULA

The number of distinct Hamilton cycles in a complete graph with $nn$ vertices is $(n−1)!(n−1)!$

## Example 12.36

### Counting Hamilton Cycles in a Complete Graph

How many Hamilton cycles are in the complete graph in Figure 12.163?

Figure 12.163 Complete Graph L

1.
How many Hamilton cycles are in the graph?
Complete Graph R

## Weighted Graphs

Suppose that an officer in the U.S. Air Force who is stationed at Vandenberg Air Force base must drive to visit three other California Air Force bases before returning to Vandenberg. The officer needs to visit each base once. The vertices in the graph in Figure 12.164 represent the four U.S. Air Force bases, Vandenberg, Edwards, Los Angeles, and Beale. The edges are labeled to with the driving distance between each pair of cities.

Figure 12.164 Graph of Four California Air Force Bases

The graph in Figure 12.164 is called a weighted graph, because each edge has been assigned a value or weight. The weights can represent quantities such as time, distance, money, or any quantity associated with the adjacent vertices joined by the edges. The total weight of any walk, trail, or path is the sum of the weights of the edges it visits.

Notice that the officer’s trip can be represented as a Hamilton cycle, because each of the four vertices in the graph is visited exactly once.

## Example 12.37

### Finding Hamilton Cycles of Lowest Weight

Use Figure 12.164 and the given Hamilton cycles to answer the following questions.

VLEBV

VLBEV

VELBV

VBELV

1. Which of the Hamilton cycles (directed cycles) lie on the same cycle (undirected cycle) in the graph?
2. Find the total weight of each cycle.
3. Of the four, which of the Hamilton cycles describes the shortest trip for the officer? Describe the route.

1.
Find the weight of the Hamilton cycle mopnqm in the given figure.
Weighted Complete Graph with Five Vertices

For the following exercises, fill in the blank to make the statement true.
57.
A Hamilton cycle is a circuit that visits each ___________ exactly once.
58.
A __________ graph with $n \geq 3$ vertices has $\left( {n - 1} \right)!$ Hamilton cycles.
For the following exercises, fill in the blank with is or is not to make the statement true.
59.
A Hamilton cycle ________ a circuit.
60.
A Hamilton cycle that visits every edge ________ an Euler circuit.
61.
A Hamilton cycle ________ different from a Hamilton circuit.
62.
An Euler circuit that visits every vertex ________ a Hamilton cycle.
63.
The total weight of a trail _______ the sum of the weights of the edges visited by the trail.
64.
A weighted graph _______ always a complete graph.
65.
The number of ways to arrange n objects _______ $\left( {n - 1} \right)!$
66.
Every cycle ____ a circuit.

## Section 12.7 Exercises

For the following exercises, use the figure to determine whether the sequence of vertices in the given graph is a Hamilton cycle, an Euler circuit, both, or neither.
1 .
Graph A: fbgedcf
2 .
Graph A: gbfcdeg
3 .
Graph A: degdfbgfcd
4 .
Graph L: hiknjh
5 .
Graph L: nihjmkn
6 .
Graph L: jinkijkmj
7 .
Graph U: vwrstoqv
8 .
Graph U: wqrstovw
For the following exercises, use the figure to find a circuit that fits the description.
9 .
A Hamilton cycle in Graph P that begins at vertex c.
10 .
An Euler circuit in Graph P that begins at vertex c.
11 .
A directed cycle in Graph P that is NOT a Hamilton cycle, and explain why it is not a Hamilton cycle.
12 .
A directed circuit in Graph P that is NOT an Euler circuit, and explain why it is not an Euler circuit.
13 .
A Hamilton cycle in Graph Q that begins at vertex n.
14 .
An Euler circuit in Graph Q that begins at vertex n.
15 .
A directed cycle in Graph Q that is NOT a Hamilton cycle, and explain why it is not a Hamilton cycle.
16 .
A directed circuit in Graph Q that is NOT an Euler circuit, and explain why it is not an Euler circuit.
17 .
Use the results of Exercises 9–16 to make an observation about which tends to involve a longer sequence of vertices, Hamilton cycles or Euler circuits. Explain why you think this is.
For the following exercises, evaluate the factorial expression for the given value of $n$.
18 .
$n!,\,{n} = 10$
19 .
$n!,\,{n} = 11$
20 .
$\left( {n - 1} \right)!,\,{n} = 10$
21 .
$\left( {n - 1} \right)!,\,{n} = 11$
For the following exercises, find the number of arrangements letters in the given word.
22 .
have
23 .
teamwork
24 .
anime
25 .
making
For the following exercises, find the number of Hamilton cycles in a complete graph with the given number of vertices.
26 .
12 vertices
27 .
13 vertices
28 .
9 vertices
29 .
8 vertices
30 .
$x$ vertices
For the following exercises, given the number of Hamilton cycles in a complete graph, determine the number of vertices.
31 .
$5! = 120$ Hamilton cycles
32 .
$6! = 720$ Hamilton cycles
33 .
$7! = 5040$ Hamilton cycles
34 .
$x!$ Hamilton cycles
For the following exercises, all the distinct Hamilton cycles for a complete graph are given. Indicate which pairs of Hamilton cycles (directed cycles) lie on the same cycle (undirected cycle) in the graph.
35 .

1. bacdb
4. bcdab
5. bdacb
6. bdcab
36 .

1. ifghei
2. ifgehi
3. ifhgei
4. ifhegi
5. ifeghi
6. ifehgi
7. igfhei
8. igfehi
9. ighfei
10. ighefi
11. igefhi
12. igehfi
13. ihgfei
14. ihgefi
15. ihfgei
16. ihfegi
17. ihegfi
18. ihefgi
19. ieghfi
20. iegfhi
21. iehgfi
22. iehfgi
23. iefghi
24. iefhgi
For the following exercises, use the figure to find the weight of the given Hamilton cycle.
37 .
qrsvyxwtuq
38 .
uyxwtqrsvu
39 .
yvsruqtwxy
40 .
uvsrqtwxyu
41 .
The neighborhood of Pines West has three cul-de-sacs that meet at an intersection as shown. A postal delivery person starts at the intersection and visits each house in a cul-de-sac once, returns to the intersection, visits each house in the next cul-de-sac, and so on, returning to the intersection when finished. Describe how the route can be represented as a graph. If there is no backtracking, in other words, the person never reverses direction, is the route followed by the postal delivery person best described as a trail, an Euler circuit, a Hamilton cycle, or neither? Explain your reasoning.
42 .
In chess, a knight can move in any direction, but it must move two spaces then turn and move one more space. The 8 possible moves a knight can make from a given space are shown in the figure.

A graph in which each vertex represents a space on a five-by-six game board and each edge represents a move a knight could make is shown in the figure.

A knight’s tour is a sequence of moves by a knight on a chessboard (of any size) such that the knight visits every square exactly once. If the knight’s tour brings the knight back to its starting position on the board, it is called a closed knight’s tour. Otherwise, it is called an open knight’s tour.

Determine if the closed knight’s tour in Figure 12.239 is most accurately described as an Euler circuit or a Hamilton cycle, or both, of the graph of all possible knight moves. Explain your reasoning.
Order a print copy

As an Amazon Associate we earn from qualifying purchases.