Lably
Skip to content

Hamiltonian path problem

Problem of finding a cycle through all vertices of a graph

  • 8 min read
  • 5 chapters

Related on Lably

Through Directed graph, Graph (discrete mathematics) and Degree (graph theory)

The Hamiltonian cycle problem is similar to the Hamiltonian path problem, except it asks if a given graph contains a Hamiltonian cycle. This problem may also specify the start of the cycle. The Hamiltonian cycle problem is a special case of the travelling salesman problem, obtained by setting the distance between two cities to one if they are adjacent and two otherwise, and verifying that the total distance travelled is equal to n. If so, the route is a Hamiltonian cycle.

The Hamiltonian path problem and the Hamiltonian cycle problem belong to the class of NP-complete problems, as shown in Michael Garey and David S. Johnson's book Computers and Intractability: A Guide to the Theory of NP-Completeness and Richard Karp's list of 21 NP-complete problems.

Reductions

Reduction from the path problem to the cycle problem

The problems of finding a Hamiltonian path and a Hamiltonian cycle can be related as follows:

  • In one direction, the Hamiltonian path problem for graph G can be related to the Hamiltonian cycle problem in a graph H obtained from G by adding a new universal vertex x, connecting x to all vertices of G. Thus, finding a Hamiltonian path cannot be significantly slower (in the worst case, as a function of the number of vertices) than finding a Hamiltonian cycle.
  • In the other direction, the Hamiltonian cycle problem for a graph G is equivalent to the Hamiltonian path problem in the graph H obtained by adding terminal (degree-one) vertices s and t attached respectively to a vertex v of G and to v', a cleaved copy of v which gives v' the same neighbourhood as v. The Hamiltonian path in H running through vertices ⁠s−v−x−⋯−y−v′−t⁠ corresponds to the Hamiltonian cycle in G running through ⁠v−x−⋯−y(−v)⁠.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Discrete mathematics