Hamiltonian Cycles and Paths
While Eulerian circuits visit every edge exactly once, Hamiltonian cycles visit every vertex exactly once. Despite this similar-sounding definition, the Hamiltonian problem is dramatically harder—it's NP-complete, with no efficient algorithm known.
A Hamiltonian cycle is a cycle that visits every vertex of a graph exactly once (except the start/end vertex which appears twice). A Hamiltonian path visits every vertex exactly once with no return to the start.
A graph is Hamiltonian if it contains a Hamiltonian cycle, and traceable if it contains a Hamiltonian path.
Unlike Eulerian graphs, no simple characterization exists for Hamiltonian graphs. The decision problem "does graph have a Hamiltonian cycle?" is NP-complete, making it computationally intractable for large graphs.
If is a connected graph with vertices and every vertex has degree at least , then is Hamiltonian.
This sufficient condition guarantees a Hamiltonian cycle through a minimum degree requirement, though the condition is not necessary.
If has vertices and for every pair of non-adjacent vertices , we have , then is Hamiltonian.
Ore's theorem generalizes Dirac's: if for all , then for any pair.
The Petersen graph is a famous counterexample: it has 10 vertices, each of degree 3, but is non-Hamiltonian. It satisfies many nice properties (vertex-transitive, 3-connected) yet has no Hamiltonian cycle. This shows that high connectivity doesn't guarantee Hamiltonicity.
However, the Petersen graph does have many Hamiltonian paths, demonstrating that non-Hamiltonian graphs can still be traceable.
Given a weighted complete graph , find a Hamiltonian cycle of minimum total weight. This is the Traveling Salesman Problem, one of the most famous NP-hard optimization problems.
Approximation algorithms exist: the Christofides algorithm guarantees a solution within 1.5× optimal for metric TSP (where edge weights satisfy the triangle inequality).
Knight's Tour problem asks whether a knight can visit every square of a chessboard exactly once, moving according to chess rules. This is a Hamiltonian path problem on the knight's graph. An board admits many knight's tours, but determining their existence for arbitrary board sizes remains an interesting combinatorial problem.
- Eulerian circuit: Polynomial time (Hierholzer's algorithm)
- Hamiltonian cycle: NP-complete (no known polynomial algorithm)
This stark contrast illustrates how superficially similar problems can have vastly different computational complexity. The Hamiltonian cycle problem remains one of Karp's original 21 NP-complete problems.
The difficulty of the Hamiltonian problem has driven development of approximation algorithms, heuristics, and complexity theory, while also finding applications in logistics, DNA sequencing, and circuit board drilling optimization.