This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 GRAPH UTILITIES PACKAGE SYMBOL

# HamiltonianCycles

 gives a list of n Hamiltonian cycles. HamiltonianCycles[g]gives a list of one Hamiltonian cycle.
• returns an empty list if no Hamiltonian cycle exists.
• considers the input graph as undirected.
• The complexity of the algorithm is such that finding all Hamiltonian cycles for a large graph can take an exponential amount of time.
This defines a small graph and finds a Hamiltonian cycle of the graph:
This plots the graph and highlights the cycle in red:
This finds all Hamiltonian cycles:
Needs["GraphUtilities`"]
This defines a small graph and finds a Hamiltonian cycle of the graph:
 Out[3]=
 Out[4]=
This plots the graph and highlights the cycle in red:
 Out[5]=
This finds all Hamiltonian cycles:
 Out[6]=
 Applications   (1)
This finds all possible Hamiltonian cycles in the graph consisting of bordering countries in South America:
This shows the first of these two cycles; the second is just a reversal of the first:
A graph that has a Hamiltonian cycle must be biconnected:
A graph that is biconnected does not necessarily have a Hamiltonian cycle: