

In themathematical field ofgraph theory, aHamiltonian path (ortraceable path) is apath in an undirected or directed graph that visits eachvertex exactly once. AHamiltonian cycle (orHamiltonian circuit) is acycle that visits each vertex exactly once. A Hamiltonian path that starts and ends at adjacent vertices can be completed by adding one more edge to form a Hamiltonian cycle, and removing any edge from a Hamiltonian cycle produces a Hamiltonian path. The computational problems of determining whether such paths and cycles exist in graphs areNP-complete; seeHamiltonian path problem for details.
Hamiltonian paths and cycles are named afterWilliam Rowan Hamilton, who invented theicosian game, now also known asHamilton's puzzle, which involves finding a Hamiltonian cycle in the edge graph of thedodecahedron. Hamilton solved this problem using theicosian calculus, analgebraic structure based onroots of unity with many similarities to thequaternions (also invented by Hamilton). This solution does not generalize to arbitrary graphs.
Despite being named after Hamilton, Hamiltonian cycles in polyhedra had also been studied a year earlier byThomas Kirkman, who, in particular, gave an example of a polyhedron without Hamiltonian cycles.[1] Even earlier, Hamiltonian cycles and paths in theknight's graph of thechessboard, theknight's tour, had been studied in the 9th century inIndian mathematics byRudrata, and around the same time inIslamic mathematics byal-Adli ar-Rumi. In 18th century Europe, knight's tours were published byAbraham de Moivre andLeonhard Euler.[2]
AHamiltonian path ortraceable path is apath that visits each vertex of the graph exactly once. A graph that contains a Hamiltonian path is called atraceable graph. A graph isHamiltonian-connected if for every pair of vertices there is a Hamiltonian path between the two vertices.
AHamiltonian cycle,Hamiltonian circuit,vertex tour orgraph cycle is acycle that visits each vertex exactly once. A graph that contains a Hamiltonian cycle is called aHamiltonian graph.
Similar notions may be defined fordirected graphs, where each edge (arc) of a path or cycle can only be traced in a single direction (i.e., the vertices are connected with arrows and the edges traced "tail-to-head").
AHamiltonian decomposition is an edge decomposition of a graph into Hamiltonian circuits.
AHamilton maze is a type of logic puzzle in which the goal is to find the unique Hamiltonian cycle in a given graph.[3][4]


Any Hamiltonian cycle can be converted to a Hamiltonian path by removing one of its edges, but a Hamiltonian path can be extended to a Hamiltonian cycle only if its endpoints are adjacent.
All Hamiltonian graphs arebiconnected, but a biconnected graph need not be Hamiltonian (see, for example, thePetersen graph).[9]
AnEulerian graphG (aconnected graph in which every vertex has even degree) necessarily has an Euler tour, a closed walk passing through each edge ofG exactly once. This tour corresponds to a Hamiltonian cycle in theline graphL(G), so the line graph of every Eulerian graph is Hamiltonian. Line graphs may have other Hamiltonian cycles that do not correspond to Euler tours, and in particular the line graphL(G) of every Hamiltonian graphG is itself Hamiltonian, regardless of whether the graphG is Eulerian.[10]
Atournament (with more than two vertices) is Hamiltonian if and only if it isstrongly connected.
The number of different Hamiltonian cycles in a complete undirected graph onn vertices is(n − 1)!/2 and in a complete directed graph onn vertices is(n − 1)!. These counts assume that cycles that are the same apart from their starting point are not counted separately.
The best vertexdegree characterization of Hamiltonian graphs was provided in 1972 by theBondy–Chvátal theorem, which generalizes earlier results byG. A. Dirac (1952) andØystein Ore. Both Dirac's and Ore's theorems can also be derived fromPósa's theorem (1962). Hamiltonicity has been widely studied with relation to various parameters such as graphdensity,toughness,forbidden subgraphs anddistance among other parameters.[11] Dirac and Ore's theorems basically state that a graph is Hamiltonian if it hasenough edges.
The Bondy–Chvátal theorem operates on theclosurecl(G) of a graphG withn vertices, obtained by repeatedly adding a new edgeuv connecting anonadjacent pair of verticesu andv withdeg(v) + deg(u) ≥n until no more pairs with this property can be found.
Bondy–Chvátal Theorem (1976)—A graph is Hamiltonian if and only if its closure is Hamiltonian.
As complete graphs are Hamiltonian, all graphs whose closure is complete are Hamiltonian, which is the content of the following earlier theorems by Dirac and Ore.
Dirac's Theorem (1952)—Asimple graph withn vertices () is Hamiltonian if every vertex has degree or greater.
Ore's Theorem (1960)—Asimple graph withn vertices () is Hamiltonian if, for every pair of non-adjacent vertices, the sum of their degrees isn or greater.
The following theorems can be regarded as directed versions:
Ghouila–Houiri (1960)—Astrongly connectedsimpledirected graph withn vertices is Hamiltonian if every vertex has a full degree greater than or equal ton.
Meyniel (1973)—Astrongly connectedsimpledirected graph withn vertices is Hamiltonian if the sum of full degrees of every pair of distinct non-adjacent vertices is greater than or equal to
The number of vertices must be doubled because each undirected edge corresponds to two directed arcs and thus the degree of a vertex in the directed graph is twice the degree in the undirected graph.
Rahman–Kaykobad (2005)—Asimple graph withn vertices has a Hamiltonian path if, for every non-adjacent vertex pairs the sum of their degrees and their shortest path length is greater thann.[12]
The above theorem can only recognize the existence of a Hamiltonian path in a graph and not a Hamiltonian Cycle.
Many of these results have analogues for balancedbipartite graphs, in which the vertex degrees are compared to the number of vertices on a single side of the bipartition rather than the number of vertices in the whole graph.[13]
Theorem—A 4-connected planar triangulation has a Hamiltonian cycle.[14]
Theorem—A 4-connected planar graph has a Hamiltonian cycle.[15]
An algebraic representation of the Hamiltonian cycles of a given weighted digraph (whose arcs are assigned weights from a certain ground field) is theHamiltonian cycle polynomial of its weighted adjacency matrix defined as the sum of the products of the arc weights of the digraph's Hamiltonian cycles. This polynomial is not identically zero as a function in the arc weights if and only if the digraph is Hamiltonian. The relationship between the computational complexities of computing it andcomputing the permanent was shown by Grigoriy Kogan.[16]