Hamiltonian Paths and Cycles
A Hamiltonian question asks whether a graph has a single route that visits every vertex exactly once. Before searching for such a route, it is useful to check two basic features: whether the graph is connected and whether its vertices have enough incident edges. These checks can rule out a Hamiltonian cycle without requiring an exhaustive search. They are necessary conditions, not a general method for constructing a cycle.
Throughout, graphs are finite and simple. A path is a sequence of distinct vertices in which consecutive vertices are adjacent. A path with one vertex and no edges is allowed. A graph is connected if every pair of distinct vertices can be joined by a path; a graph with one vertex is therefore connected. A graph with at least two vertices that is not connected is disconnected.
Thus, a Hamiltonian path in a graph of order \(n\geq 1\) lists all \(n\) vertices once, in some order, with an edge between consecutive vertices. A Hamiltonian cycle lists all vertices once and also has an edge from the last vertex back to the first. In particular, a Hamiltonian cycle is a closed route; a Hamiltonian path need not be closed. The minimum degree \(\delta(G)\) is the smallest of the degrees of the vertices of \(G\).
Connectivity Is Necessary
Proof. Suppose first that \(G\) has a Hamiltonian path \(v_1,v_2,\dots,v_n\). For any two distinct vertices \(v_i\) and \(v_j\), the part of this sequence between them is a path joining them: if \(i<j\), it is \(v_i,v_{i+1},\dots,v_j\), and if \(j<i\), reverse the corresponding segment. So every pair of distinct vertices is joined by a path, and \(G\) is connected. This also covers \(n=1\), for which there are no distinct pairs to check. If \(G\) has a Hamiltonian cycle, deleting any one edge of that cycle leaves a path containing all vertices, so the first conclusion applies. \(\square\)
The essential point is that a Hamiltonian path or cycle uses consecutive edges to travel through all the vertices. If the graph separates into components with no edges between them, no such route can move from one component to another. Connectivity is therefore a necessary test for both kinds of Hamiltonian structure.
Worked Example: A Disconnected Graph Fails the Connectivity Test
Let \(G=(V,E)\), where \(V=\{1,2,3,4,5,6\}\) and \(E=\{12,23,31,45,56,64\}\). The edges \(12,23,31\) form a triangle on \(\{1,2,3\}\), and \(45,56,64\) form a triangle on \(\{4,5,6\}\).
Each vertex has two incident edges: \(\deg(1)=\deg(2)=\deg(3)=2\), and \(\deg(4)=\deg(5)=\deg(6)=2\). Hence \(\delta(G)=2\). But there is no edge with one endpoint in \(\{1,2,3\}\) and the other in \(\{4,5,6\}\). No path can join a vertex of the first set to a vertex of the second, so \(G\) is disconnected.
Conclusion: The graph has minimum degree two, but it has neither a Hamiltonian path nor a Hamiltonian cycle, because it is disconnected. The degree check alone would not detect this obstruction; connectivity must also be checked.
Check: The six listed edges give degree two at every vertex, while none crosses between the two vertex sets. This verifies both \(\delta(G)=2\) and the failure of connectivity directly from the edge list.
Minimum Degree Is Necessary for a Hamiltonian Cycle
Proof. Connectivity follows from the proposition. To prove the degree condition, let \(C\) be a Hamiltonian cycle in \(G\). Since \(C\) contains every vertex and is a cycle, each vertex \(v\) on \(C\) has two neighboring vertices on the cycle: its predecessor and its successor as we go around \(C\). These two vertices are distinct because a cycle in a simple graph has length at least three. Therefore \(v\) is incident with two distinct edges of \(G\), and \(\deg(v)\geq 2\). This holds for every vertex \(v\), so the smallest vertex degree satisfies \(\delta(G)\geq 2\). \(\square\)
The two edges required at each vertex have different roles in a cycle: one brings the route into the vertex and the other takes it out. A vertex of degree zero or one cannot provide both. This argument applies to Hamiltonian cycles; a Hamiltonian path has two endpoints, and each endpoint uses just one edge of the path. Consequently, the theorem does not assert that every vertex of a graph with a Hamiltonian path has degree at least two.
The implication points in one direction. If a graph is disconnected or has a vertex of degree less than two, then it cannot be Hamiltonian. If it is connected and every vertex has degree at least two, these particular obstructions are absent; that fact alone does not prove that the graph has a Hamiltonian cycle.
Worked Example: A Connected Graph with a Degree-One Vertex
Let \(G=(V,E)\), where \(V=\{1,2,3,4\}\) and \(E=\{12,23,34\}\). The edges form the path \(1,2,3,4\). Its degrees are \(\deg(1)=1\), \(\deg(2)=2\), \(\deg(3)=2\), and \(\deg(4)=1\), so \(\delta(G)=1\).
The graph is connected: for example, the path between vertices \(1\) and \(4\) is \(1,2,3,4\), and every pair of vertices can be joined by the segment of this sequence between them. It does not have a Hamiltonian cycle, because vertices \(1\) and \(4\) each have only one incident edge, whereas every vertex on a cycle must have at least two distinct incident edges.
It does have a Hamiltonian path, namely \(1,2,3,4\). This path visits all four vertices exactly once and uses the three listed edges in order. Thus connectivity is necessary for a Hamiltonian path, but the minimum-degree-two condition is a necessary test for a Hamiltonian cycle, not for a Hamiltonian path.
Check: The listed path uses the edges \(12\), \(23\), and \(34\), and includes all four vertices. The degree calculation gives \(\delta(G)=1\), as required for this example to show that a Hamiltonian path need not satisfy the cycle degree condition.
Applying Both Tests
A practical first check for Hamiltonicity is to ask two separate questions:
- Is the graph connected?
- Does every vertex have degree at least two?
If the answer to either question is no, the graph cannot have a Hamiltonian cycle. If both answers are yes, the tests have not ruled out a Hamiltonian cycle, but further reasoning is needed to decide whether one exists. In particular, it would be a logical error to reverse the theorem and conclude that every connected graph with minimum degree at least two is Hamiltonian.
Worked Example: A Cycle Passes Both Necessary Tests
Let \(G=(V,E)\), where \(V=\{1,2,3,4,5\}\) and \(E=\{12,23,34,45,51\}\). The sequence \(1,2,3,4,5,1\) follows the edges \(12,23,34,45,51\), respectively. It visits all five vertices once before returning to its starting vertex, so it is a Hamiltonian cycle.
For completeness, the degrees from the edge list are \(\deg(1)=2\), since its incident edges are \(12\) and \(51\); \(\deg(2)=2\), from \(12\) and \(23\); \(\deg(3)=2\), from \(23\) and \(34\); \(\deg(4)=2\), from \(34\) and \(45\); and \(\deg(5)=2\), from \(45\) and \(51\). Thus \(\delta(G)=2\). The displayed cycle also joins every pair of vertices by a segment of the cycle, so \(G\) is connected.
Check: There are five vertices and the displayed cycle contains each exactly once before returning to \(1\). Each vertex has two incident listed edges, giving minimum degree two, consistent with the necessary-condition theorem.
Common Pitfalls and How to Use the Conditions
Confusing a path condition with a cycle condition. A common incorrect calculation is to look at the Hamiltonian path \(1,2,3,4\) in the previous example and claim that its endpoints have degree two because the route has an edge before and after each vertex. But in the graph, vertex \(1\) has only the neighbor \(2\), so \(N(1)=\{2\}\) and \(\deg(1)=1\). The route has no edge before its first vertex. That is allowed in a path, but a cycle must return to its start, and therefore requires two distinct incident edges at every vertex.
Checking degree without checking connectivity. The two disjoint triangles above have minimum degree two but are disconnected. A degree calculation examines how many edges meet each vertex; it does not show that paths exist between different parts of the graph. Check connectivity separately.
Treating necessary conditions as a complete decision rule. The theorem proves that a Hamiltonian graph must pass both tests. It does not prove the converse. Passing them tells us only that neither of these two obstructions has been found. A proof of Hamiltonicity still needs to exhibit a cycle or use a valid sufficient condition; a proof of non-Hamiltonicity may require a different obstruction.
These tests are most useful at the start of a Hamiltonicity problem. A degree-zero vertex in a graph with other vertices immediately violates the minimum-degree condition and also signals a connectivity problem. A degree-one vertex rules out a Hamiltonian cycle. A disconnected graph rules out both a Hamiltonian path and a Hamiltonian cycle. Detecting such failures early can save an unnecessary search through candidate routes.
Check Your Understanding
For each question, distinguish what follows for Hamiltonian paths from what follows for Hamiltonian cycles.
- State the definition of a Hamiltonian path and explain why any graph with one must be connected.
- A graph has a vertex of degree one. Which Hamiltonian structure is ruled out by the minimum-degree argument: a Hamiltonian path, a Hamiltonian cycle, or both?
- For the graph with \(V=\{1,2,3,4,5,6\}\) and \(E=\{12,23,31,45,56,64\}\), compute the minimum degree and explain why the graph is not Hamiltonian.
- Give the degrees of the vertices in the graph with \(V=\{1,2,3,4\}\) and \(E=\{12,23,34\}\). Which Hamiltonian structure does its displayed vertex order provide?
- Does being connected with minimum degree at least two, by itself, prove that a graph is Hamiltonian? Explain what the necessary-condition theorem does establish.