Professional Documents
Culture Documents
In the last section, we considered optimizing a walking route for a postal carrier. How is
this different than the requirements of a package delivery driver? While the postal
carrier needed to walk down every street (edge) to deliver the mail, the package
delivery driver instead needs to visit every one of a set of delivery locations. Instead of
looking for a circuit that covers every edge once, the package deliverer is interested in a
circuit that visits every vertex once.
A Hamiltonian circuit is a circuit that visits every vertex once with no repeats. Being a circuit,
it must start and end at the same vertex. A Hamiltonian path also visits every vertex once
with no repeats, but does not have to start and end at the same vertex.
Hamiltonian circuits are named for William Rowan Hamilton who studied them in the
1800’s.
EXAMPLE
One Hamiltonian circuit is shown on the graph below. There are several other Hamiltonian
circuits possible on this graph. Notice that the circuit only has to visit every vertex once; it does
not need to use every edge.
This circuit could be notated by the sequence of vertices visited, starting and ending at the
same vertex: ABFGCDHMLKJEA. Notice that the same circuit could be written in reverse order,
or starting and ending at a different vertex.
Unlike with Euler circuits, there is no nice theorem that allows us to instantly determine
whether or not a Hamiltonian circuit exists for all graphs.[1]
EXAMPLE
We can see that once we travel to vertex E there is no way to leave without returning to C, so
there is no possibility of a Hamiltonian circuit. If we start at vertex E we can find several
Hamiltonian paths, such as ECDAB and ECABD
This problem is called the Traveling salesman problem (TSP) because the question
can be framed like this: Suppose a salesman needs to give sales pitches in four cities.
He looks up the airfares between each city, and puts the costs in a graph. In what order
should he travel to visit each city once then return home with the lowest cost?
To answer this question of how to find the lowest cost Hamiltonian circuit, we will
consider some possible approaches. The first option that might come to mind is to just
try all different possible circuits.
question can be framed like this: Suppose a salesman needs to give sales pitches in
four cities. He looks up the airfares between each city, and puts the costs in a graph. In
what order should he travel to visit each city once then return home with the lowest
cost?
To answer this question of how to find the lowest cost Hamiltonian circuit, we will
consider some possible approaches. The first option that might come to mind is to just
try all different possible circuits.
EXAMPLE
Apply the Brute force algorithm to find the minimum cost Hamiltonian circuit on the graph below.
To apply the Brute force algorithm, we list all possible Hamiltonian circuits and calculate their
weight:
Circuit Weight
ABCDA 4+13+8+1 = 26
ABDCA 4+9+8+2 = 23
ACBDA 2+13+9+1 = 25
Note: These are the unique circuits on this graph. All other possible circuits are the reverse of
the listed ones or start at a different vertex, but result in the same weights.
From this we can see that the second circuit, ABDCA, is the optimal circuit.
https://courses.lumenlearning.com/math4liberalarts/chapter/introduction-euler-paths/
A Hamiltonian path, also called a Hamilton path, is a graph path between two vertices of a graph that visits each
vertex exactly once. If a Hamiltonian path exists whose endpoints are adjacent, then the resulting graph cycle is
called a Hamiltonian cycle (or Hamiltonian cycle).
In general, the problem of finding a Hamiltonian path is NP-complete (Garey and Johnson 1983, pp. 199-200), so the
only known way to determine whether a given general graph has a Hamiltonian path is to undertake an exhaustive
search
Any bipartite graph with a vertex parity unbalance has no Hamiltonian paths.
The total numbers of directed Hamiltonian paths for all simple graphs of orders , 2, ... are 0, 2, 8, 50, 416,
5616, 117308, 4862736, ... (OEIS A193352).
Rubin (1974) describes an efficient search procedure that can find some or all Hamilton paths and circuits in a graph
using deductions that greatly reduce backtracking and guesswork. A probabilistic algorithm due to Angluin and
Valiant (1979), described by Wilf (1994), can also be useful to find Hamiltonian cycles and paths. A Hamiltonian path
between two vertices and can be found if an algorithm for Hamiltonian cycles is available. This can be done by
checking if the original graph contains the edge and adding it if not to obtain . Since a Hamiltonian path
with adjacent endpoints is a Hamiltonian cycle and since and are now adjacent, finding a Hamiltonian cycle and
splitting at the edge gives a Hamiltonian path from to in . Similarly, if no Hamiltonian cycle exists in , then
there is no Hamiltonian path from to in .
The following table summarizes the numbers of (undirected) Hamiltonian paths on various classes of graphs.
antiprism graph A124352 X, X, 120, 408, 1200, 3240, 8330, 20720, ...
gear graph A046092 X, X, 12, 20, 30, 42, 56, 72, 90, 110, ...
ladder graph A137882 1, 4, 8, 14, 22, 32, 44, 58, 74, 92, ...
Möbius ladder A137883 X, X, 36, 72, 140, 228, 364, 528, 756, ...
prism graph A124350 X, X, 30, 72, 130, 228, 350, 528, ...
sun graph A046092 X, X, 12, 20, 30, 42, 56, 72, 90, 110, ...
triangular grid graph A112675 3, 12, 114, 1968, 66312, 4381020, 57826621, ...
wheel graph A033996 X, X, X, 12, 24, 40, 60, 84, 112, 144, ...
Closed forms for some of these classes of graphs are summarized in the following table.
graph formula
barbell graph
complete graph
cycle graph
gear graph
ladder graph
Möbius ladder
path graph 1
prism graph
sun graph
wheel graph
Recurrence relations for the number of directed Hamiltonian paths for some graph families are summarized below.
antiprism graph 9
crown graph 3
prism graph 6
http://mathworld.wolfram.com/HamiltonianPath.html