A HamiltonianPath or Cycle is a walk that visits each vertex, except the first and last vertex are the same (closed). A Graph is called a Hamiltonian Graph if it contains a Hamiltonian Cycle.
How many edges do we need to ensure that a graph is Hamiltonian? How big does the minimum degree of graphG, δ(G) need to be to ensure Hamiltonian? Suppose we had graph
Kn/2∘Kn/2
which is disconnected. We have that δ(G)=(n/2)−1. Here, the graph is almost Hamiltonian. Indeed, if we picked any size Km,Kn−m then δ(G)=min(m−1,n−m−1) to ensure δ(G) is maximized, it follows m=n/2.
Proof:
If u,v∈V, then we need to prove there is a path u→v. We have n−2 other vertices. We have 2 cases:
If there is an edge (u,v), then we are done.
If there is no edge, then we know u,v connects to at least 2n−1 vertices each. Then, find vertex w with (u,w) and (w,v). If so, we are done.
If there set of incident vertices from the edges of v and u are disjoint, then the total number of vertices is at least
2n−1+2n−1=n−1
which is a contradiction on ∣V∣=n−2. And so both sets must overlap, and thus w exists.
Lemma (Force a Cycle by Minimum Degree)
If δ(G)≥n/2 and if it has a path P of length k, then if k<n=∣V∣, then we have a path of length k+1 we can find. Otherwise, if k=n, then we have a cycle of length n.
Intuitively:
If you have a “long path”, then we can use this to find a “longer path” by possibly finding a cycle in between. Then you can repeat this until you find all the vertices.
Proof:
Suppose we have a path P
P:v1,v2,…,vm
I claim we can either extend this path or turn it into a cycle.
If there is some vertex u or w not in P but (u,v1) or (vm,w) exists, then we can extend P unless v1,vm only connect to other vi for 1<i<m. Then we are done.
Otherwise, we can turn P to a cycle with the same vertices. If there is an edge (v1,vm), then we are done. If for some i, we have edges (v1,vi+1) and (vi,vm), we can create the following path which gives us a cycle:
source code
Let S be set of indices i∈{1,…,m−1} for which edge (vi,vm) exists. Let T be the same for edge (v1,vi+1). Since P is assumed to be maximal length, all neighbors of its endpoints must lie within the path itself. Therefore the number of neighbors for each endpoint corresponds to
∣S∣=deg(vm)≥n/2∣T∣=deg(v1)≥n/2
We want to find an index i that belongs to both S and T, giving us the edges to form the cycle. Assume for the sake of contradiction that S∩T=∅. Then,
∣S∪T∣=∣S∣+∣T∣≥2n+2n=n
But then as S∪T⊆{1,2,…,m−1}, then
∣S∪T∣nn+1≤∣{1,2,…,m−1}∣=m−1≤∣S∪T∣≤m−1≤m
implying that the number of edges in our maximal length path P is greater than the number of vertices in G, a contradiction.
We are using the Pidgeonhole Principle here.
Theorem (Hamiltonian: Minimum Vertex and Degree)
If G=(V,E) and
∣V∣=n>2
δ(G)≥n/2
then G is Hamiltonian.
Proof:
Assume by contradiction that G is not Hamiltonian. Because G is not Hamiltonian, there is no path of length n−1. Let P be a maximal path of length m.
By Lemma (Force a Cycle by Minimum Degree), and that P is maximal, we must have a cycle C containing all k vertices of P. But then we have a cycle of length k<n, such that there must be a vertex u in this graph not in the cycle. But as δ(G)≥n/2, then by Lemma (Minimum Degree for Connectivity)G is connected, such that there is a vj that connects to u.
Consider this path P′, from u→vj and then the entire cycle C. Then P′ has k+1 vertices. But then this is a contradiction as we do not have a path of maximal length k. Thus G must be Hamiltonian.