Explore modules

Hamiltonian Cycles

Search for closed routes that visit every vertex once and compare them with edge-covering Eulerian routes.

Free theory article

Search for closed routes that visit every vertex once and compare them with edge-covering Eulerian routes.

Concept & interpretation

A Hamiltonian cycle visits every vertex exactly once and returns to its start. An Eulerian trail uses every edge exactly once; its existence and construction have efficient algorithms under the appropriate connectivity and degree conditions. Deciding whether a general graph has a Hamiltonian cycle is NP-complete.

Experiment

You can interact with a solver in the Hamiltonian Cycles module.

  1. Enter a sequence of semicolon-separated edge pairs (e.g., 0 1; 1 2; 2 3) into the "Edges" input text field.
  2. Click the "Step" button repeatedly to watch the algorithm sequentially test each candidate permutation for valid edges.
  3. Click the "Finish" button to immediately jump to the end and observe the total Hamiltonian cycle count and the first canonical cycle found in the resulting read-only text fields.
Read the full free theory article