The Euler--Hamilton divide: why "all edges" and "all vertices" are worlds apart
Determining whether a graph has an Eulerian circuit (traversing every edge exactly once) reduces to checking vertex degrees. Determining whether it has a Hamiltonian cycle (visiting every vertex exactly once) is NP-complete. This article explains why one word makes all the difference.
Graph theory harbors two problems that appear almost identical on the surface but differ astronomically in computational difficulty. An Eulerian circuit traverses every edge exactly once and returns to the start. A Hamiltonian cycle visits every vertex exactly once and returns to the start.
The first can be decided in polynomial time; the second is NP-complete – as far as anyone knows, no polynomial-time algorithm exists. "All edges" versus "all vertices": how can a single-word substitution produce such a gulf?
1 Eulerian circuits – just count the degrees
This criterion is strikingly simple. Checking whether every vertex has even degree takes time.
2 Hamiltonian cycles – even deciding existence is hard
Eulerian circuits enjoy the elegant criterion "every vertex has even degree." Is there an analogous characterization for Hamiltonian cycles?
Almost certainly not.
Some sufficient conditions are known:
But these are merely sufficient conditions, not characterizations. Many graphs that fail these conditions still possess Hamiltonian cycles.
3 Why such a vast difference? – locality versus globality
Where does this dramatic gap come from?
Let us make this more concrete.
For Eulerian circuits, even if the traversal gets "stuck," recovery is always possible (Hierholzer's algorithm exploits this). The local guarantee of even degree means that at every vertex, there is always a way forward until all edges are exhausted. For Hamiltonian cycles, an early vertex choice can have irreversible consequences at the other end of the graph, and no local fix can compensate.
4 The complexity-theoretic perspective
This difference can be stated precisely in the language of complexity theory.
Eulerian path/circuit problems are standard fare: "check degrees, then run Hierholzer."
Hamiltonian cycle problems demand bitmask DP in (the traveling salesman approach).
An Eulerian path problem with vertices is routine, while a Hamiltonian cycle problem is only feasible for .
5 The traveling salesman problem
The optimization version of the Hamiltonian cycle problem is the celebrated Traveling Salesman Problem (TSP).
TSP is NP-hard. Exact solutions can be computed by bitmask DP in , but for practical purposes one typically resorts to approximation algorithms and heuristics.
6 Takeaway – one word changes everything
Eulerian circuit: "traverse every edge once" local condition (even degrees)
Hamiltonian cycle: "visit every vertex once" global constraint -complete
The chasm between "edges" and "vertices" carries a lesson that extends far beyond graph theory: problems characterized by local conditions tend to be efficiently solvable, while problems requiring global consistency tend to be explosively hard.
In the next article, we examine another beautiful duality in graph theory – the max-flow min-cut theorem.
Mathematics "between the lines" — exploring the intuition textbooks leave out, written in LaTeX on Folio.