Eulerian and Hamiltonian Graphs

Study Sheet

Eulerian and Hamiltonian Graphs

Traversing every edge, visiting every vertex, and the theorems that decide when you can

Eulerian Circuits and Trails

Concept
Euler circuits and Euler trails

A walk that uses every edge of a graph exactly once is an Euler trail; if it starts and ends at the same vertex, it is an Euler circuit. Euler's theorem: a connected graph has an Euler circuit if and only if every vertex has even degree, and has an Euler trail but no circuit if and only if exactly two vertices have odd degree.

Every time a trail passes through a vertex without stopping there, it uses up two of that vertex's edges, one arriving and one leaving, so a vertex can only be such a pass-through point an even number of times. A circuit never stops, so every vertex contributes an even number of trail-edges there: every degree must be even. A trail that is not a circuit has exactly two special vertices, its start and its end, each contributing one unmatched edge, so only those two may be odd. This matches the handshake lemma from Graphs and Degrees (Topic 1): the number of odd-degree vertices is always even, so 00 and 22 are the only possibilities Euler's theorem can act on. The sharp part, proved in Why It Works, is that this simple local counting condition is not just necessary but sufficient: once every degree is even and the graph is connected, no global obstruction can block a circuit.

Example
An Euler circuit in K5K_5
12345
Every vertex of K5K_5 has degree 4, so an Euler circuit exists.

In the complete graph K5K_5 on {1,2,3,4,5}\{1,2,3,4,5\} (all (52)=10\binom52 = 10 edges), every vertex has degree 44, which is even, and the graph is connected, so Euler's theorem guarantees a circuit. One alternates between the outer 55-cycle and the pentagram of long diagonals:

1→2→3→4→5→1→3→5→2→4→1.1\to2\to3\to4\to5\to1\to3\to5\to2\to4\to1.

Check: the ten edges used, in order, are 12,23,34,45,51,13,35,52,24,4112, 23, 34, 45, 51, 13, 35, 52, 24, 41 — exactly the ten unordered pairs from {1,…,5}\{1,\ldots,5\}, each appearing once, and the walk returns to where it started.

Example
An Euler trail where no circuit exists

Delete edge cdcd from K4K_4 on {a,b,c,d}\{a,b,c,d\}, leaving ab,ac,ad,bc,bdab, ac, ad, bc, bd. The degree sequence is deg⁡(a)=deg⁡(b)=3\deg(a) = \deg(b) = 3 and deg⁡(c)=deg⁡(d)=2\deg(c) = \deg(d) = 2: exactly two odd vertices, so Euler's theorem promises a trail from aa to bb, not a circuit. One is

a→c→b→d→a→b,a\to c\to b\to d\to a\to b,

which uses ac,cb,bd,da,abac, cb, bd, da, ab — all five edges once, starting and ending at the two odd vertices.

Example
Does K4K_4 have an Euler circuit? Find one or prove there is none.
abcd
Every vertex of K4K_4 has odd degree 3, so no Euler trail exists at all.

Now restore edge cdcd, so every vertex of K4K_4 has degree 33. Four vertices of odd degree is already too many: Euler's theorem allows at most two. So K4K_4 has neither an Euler circuit nor an Euler trail, no matter how the six edges are ordered — some vertex other than a start or an end would need an odd number of trail-edges at it, which no trail can give it.

Side note
Where it goes wrong

Checking only "are all degrees even?" without checking connectivity. Two disjoint triangles {a,b,c}\{a,b,c\} and {d,e,f}\{d,e,f\} give every vertex degree 22, which is even, yet there is no Euler circuit: a single trail cannot jump between the two pieces, since no edge joins them. Euler's theorem requires the graph to be connected; the degree condition alone is not enough.

Try it
Try it: Euler trail in the kite

The "kite" graph has a triangle abcabc plus a pendant edge cdcd. Does it have an Euler trail? If so, find one.

Show the answer

Degrees are deg⁡(a)=deg⁡(b)=2\deg(a) = \deg(b) = 2, deg⁡(c)=3\deg(c) = 3, deg⁡(d)=1\deg(d) = 1: exactly two odd vertices, cc and dd, so a trail exists between them. One is c→a→b→c→dc\to a\to b\to c\to d, using ca,ab,bc,cdca, ab, bc, cd — all four edges once. The trail runs from c\mathbf{c} to d\mathbf{d}.

The Bridges of Konigsberg

Concept
Euler's original question

The city of Königsberg had two river banks (AA, BB) and two islands (CC, DD), joined by seven bridges: two between AA and CC, two between BB and CC, and one each for AA–DD, BB–DD, CC–DD. The question: could a walker cross every bridge exactly once? Modeled as a graph, this is exactly the question of Section 1: does the multigraph have an Euler trail?

This is the problem that started graph theory, in 1736. Euler's insight was to throw away the map entirely and keep only which landmasses each bridge joins — turning a geography puzzle into the degree-counting question of the previous section. He showed the answer was no, and in doing so found the general rule stated there: a multigraph has an Euler trail only when at most two vertices have odd degree, counting each bridge (even a parallel one) separately. A multigraph is treated exactly like an ordinary graph for this theorem, except that parallel edges each contribute their own unit to both endpoints' degree.

Example
The seven bridges
ABCD
Konigsberg's seven bridges: every landmass has odd degree.

Count the bridges at each landmass: deg⁡(A)=2+1=3\deg(A) = 2 + 1 = 3 (two to CC, one to DD), deg⁡(B)=2+1=3\deg(B) = 2 + 1 = 3, deg⁡(C)=2+2+1=5\deg(C) = 2 + 2 + 1 = 5 (two to AA, two to BB, one to DD), deg⁡(D)=1+1+1=3\deg(D) = 1 + 1 + 1 = 3. All four degrees are odd — far more than the two Euler's theorem allows. So no walk, however clever, can cross every bridge exactly once. This is Euler's actual conclusion: the walk is impossible.

Example
Removing one bridge
ABCD
With one A–C bridge gone, only B and D have odd degree.

Suppose the eastern AA–CC bridge washes out, leaving six bridges. Now deg⁡(A)=2\deg(A) = 2 and deg⁡(C)=4\deg(C) = 4, while deg⁡(B)=3\deg(B) = 3 and deg⁡(D)=3\deg(D) = 3 are unchanged: exactly two odd vertices, BB and DD. An Euler trail now exists, for instance

B→C→A→D→C→B→D,B\to C\to A\to D\to C\to B\to D,

which uses the remaining bridges BC1,CA,AD,DC,CB2,BDBC_1, CA, AD, DC, CB_2, BD once each.

Example
How many bridges would it take to fix it? (and build them)
ABCD
Two new bridges (dashed) make every degree even.

Instead of removing a bridge, suppose the city adds new ones to make a circuit possible. All four landmasses are odd, so at least two new bridges are needed (each new bridge can fix the parity of at most two vertices). Adding AA–BB and a second CC–DD bridge does it: deg⁡(A)=4\deg(A) = 4, deg⁡(B)=4\deg(B) = 4, deg⁡(C)=6\deg(C) = 6, deg⁡(D)=4\deg(D) = 4 — all even, and the graph is still connected, so by Euler's theorem a circuit exists. One is

A→C→D→A→B→C→D→B→C→A,A\to C\to D\to A\to B\to C\to D\to B\to C\to A,

using all nine bridges, AC1,CD1,DA,AB,BC1,CD2,DB,BC2,CA2AC_1, CD_1, DA, AB, BC_1, C D_2, DB, BC_2, CA_2, exactly once and returning to AA.

Side note
Where it goes wrong

Collapsing the two parallel AA–CC bridges (or the two parallel BB–CC bridges) into a single edge, as if the multigraph were an ordinary graph. That mistake gives deg⁡(A)=2\deg(A) = 2, deg⁡(B)=2\deg(B) = 2, deg⁡(C)=3\deg(C) = 3, deg⁡(D)=3\deg(D) = 3 — only two odd vertices — and wrongly suggests a trail exists. Each physical bridge is its own edge and must be counted on its own, even when two bridges join the same pair of landmasses.

Try it
Try it: a different washout

Suppose instead a storm destroys both the AA–DD bridge and the BB–DD bridge. Does the remaining network admit an Euler walk?

Show the answer

Removing those two bridges drops deg⁡(A)\deg(A) from 33 to 22, deg⁡(B)\deg(B) from 33 to 22, and deg⁡(D)\deg(D) from 33 to 11; deg⁡(C)=5\deg(C) = 5 is unchanged. Odd vertices: CC and DD — exactly two, so a trail exists between them, such as C→A→C→B→C→DC\to A\to C\to B\to C\to D using the five remaining bridges. An Euler walk exists, from C\mathbf{C} to D\mathbf{D}.

Hamiltonian Cycles

Concept
Hamiltonian cycles and paths

A Hamiltonian cycle visits every vertex of a graph exactly once and returns to its start; a Hamiltonian path visits every vertex exactly once without returning. Unlike Euler's theorem, no simple test on the degrees alone decides whether a graph has one — deciding Hamiltonicity is one of the fundamental hard (NP-complete) problems of computer science.

The two questions sound alike — trace the graph exhaustively — but they count different things: an Euler trail is a condition on edges, which are local to a vertex and so add up into a clean parity rule. A Hamiltonian cycle is a condition on vertices, but the obstruction to visiting them all is global: a single awkward vertex, or an imbalance far from where you are looking, can make the whole cycle impossible, and there is no known way to check this by scanning degrees one vertex at a time. That asymmetry is why this section can only give examples and the next section gives sufficient (not exact) conditions: strong partial answers are the best that is known.

Example
A Hamiltonian cycle in the triangular prism
a1b1c1a2b2c2
The bold edges trace a Hamiltonian cycle through the prism.

The triangular prism has two triangles a1b1c1a_1b_1c_1 and a2b2c2a_2b_2c_2 joined by the matching a1a2,b1b2,c1c2a_1a_2, b_1b_2, c_1c_2 — 66 vertices, 99 edges, every degree 33. Going around one triangle, crossing over, and returning around the other gives

a1→b1→c1→c2→b2→a2→a1,a_1\to b_1\to c_1\to c_2\to b_2\to a_2\to a_1,

using the 66 edges a1b1,b1c1,c1c2,c2b2,b2a2,a2a1a_1b_1, b_1c_1, c_1c_2, c_2b_2, b_2a_2, a_2a_1 and visiting all 66 vertices exactly once.

Example
A graph with no Hamiltonian cycle: the cut vertex
abcde
c is a cut vertex, so no Hamiltonian cycle can pass through it.

Two triangles abcabc and cdecde share only the vertex cc (the "bowtie"), giving deg⁡(c)=4\deg(c) = 4 and all other degrees 22. Vertex cc is a cut vertex: removing it disconnects {a,b}\{a,b\} from {d,e}\{d,e\}, since those pairs have no other connection. A Hamiltonian cycle, minus any one of its vertices, must leave the rest joined by a single path — but deleting cc splits the other four vertices into two disconnected pairs, which no path can do. So the bowtie has no Hamiltonian cycle, even though every vertex has degree ≥2\ge 2.

Example
Does K3,4K_{3,4} have a Hamiltonian cycle?
l1l2l3r1r2r3r4
K3,4K_{3,4}: dense, but the unequal sides block any Hamiltonian cycle.

Split 77 vertices into L={l1,l2,l3}L = \{l_1,l_2,l_3\} and R={r1,…,r4}R = \{r_1,\ldots,r_4\}, joined by all 1212 possible edges between the two sides (none within a side) — the complete bipartite graph K3,4K_{3,4}. Every edge crosses between LL and RR, so any cycle must alternate sides, L,R,L,R,…L, R, L, R, \ldots, and alternating sides forces the cycle to have even length. A Hamiltonian cycle here would need length 77 (all 77 vertices), which is odd — impossible. So K3,4K_{3,4}, despite every vertex having degree 33 or more, has no Hamiltonian cycle; the obstruction is the unequal split 3≠43 \ne 4, not a shortage of edges.

Side note
Where it goes wrong

Assuming that enough edges, or high enough degrees, must force a Hamiltonian cycle. K3,4K_{3,4} is a counterexample: it has 1212 edges and minimum degree 33, yet no Hamiltonian cycle exists, because the obstruction (an odd total split unevenly across a bipartition) has nothing to do with how many edges there are. High connectivity helps, as the next section shows, but no amount of density alone can substitute for the right structural check.

Try it
Try it: the house graph

A square ABCDABCD has a triangular roof: EE is joined to CC and DD. Does this 55-vertex graph have a Hamiltonian cycle?

Show the answer

Yes: A→B→C→E→D→AA\to B\to C\to E\to D\to A uses edges AB,BC,CE,ED,DAAB, BC, CE, ED, DA — all of them edges of the graph — and visits every vertex exactly once before closing back to AA. The cycle is A→B→C→E→D→A\mathbf{A\to B\to C\to E\to D\to A}.

Dirac's and Ore's Theorems

Concept
Sufficient conditions for a Hamiltonian cycle

Dirac's theorem: if a graph has n≥3n \ge 3 vertices and every vertex has degree ≥n/2\ge n/2, it has a Hamiltonian cycle. Ore's theorem, which implies Dirac's: if deg⁡(u)+deg⁡(v)≥n\deg(u) + \deg(v) \ge n for every pair of non-adjacent vertices u,vu, v, the graph has a Hamiltonian cycle.

These are sufficient, not necessary, conditions: a dense enough graph is forced to have a Hamiltonian cycle, even though sparser graphs can have one too. Ore's version is strictly more useful, since it only restricts pairs that are already missing an edge, letting isolated low-degree vertices through so long as their non-neighbors compensate; Dirac's theorem is the special case where EVERY vertex clears the n/2n/2 bar, so every pair, adjacent or not, automatically sums to at least nn. Both explain the previous section's K3,4K_{3,4} exactly: with n=7n = 7, two vertices on the size-44 side are non-adjacent with degree sum 3+3=6<73 + 3 = 6 < 7, so Ore's hypothesis fails for that pair — consistent with K3,4K_{3,4} having no Hamiltonian cycle, though it does not prove the absence by itself. The proofs, which explain why density alone forces a cycle, are in Why It Works.

Example
Dirac's theorem on the octahedron
123456
The octahedron: min degree 4 ≥ n/2 = 3, so Dirac's theorem applies.

Take 66 vertices 1,…,61,\ldots,6 and join every pair except the three "opposite" pairs (1,4),(2,5),(3,6)(1,4), (2,5), (3,6) — the octahedron graph, 1212 edges. Every vertex is missing only its one opposite, so deg⁡(v)=6−1−1=4\deg(v) = 6 - 1 - 1 = 4 for all vv, and n/2=3n/2 = 3: Dirac's condition holds. Indeed 1→2→3→4→5→6→11\to2\to3\to4\to5\to6\to1 is a Hamiltonian cycle, since consecutive labels are never 33 apart (never an opposite pair).

Example
Ore's theorem where Dirac's does not apply
xstpqr
x has degree 2, but every non-adjacent pair still sums to at least n = 6.

Let s,t,p,q,rs,t,p,q,r be mutually adjacent (a K5K_5), and add one more vertex xx joined only to ss and tt — 66 vertices, 1212 edges. Then deg⁡(x)=2\deg(x) = 2, well below n/2=3n/2 = 3, so Dirac's theorem says nothing. But the only non-adjacent pairs are (x,p),(x,q),(x,r)(x,p), (x,q), (x,r), each with degree sum 2+4=6=n2 + 4 = 6 = n: Ore's condition holds for every non-adjacent pair, so a Hamiltonian cycle is guaranteed. One is

x→s→p→q→r→t→x,x\to s\to p\to q\to r\to t\to x,

using edges xs,sp,pq,qr,rt,txxs, sp, pq, qr, rt, tx, all present, and visiting all 66 vertices.

Example
Why Ore's theorem could not rescue K3,4K_{3,4}

Revisit K3,4K_{3,4} (n=7n = 7) from the previous section. Its only non-adjacent pairs sit within a single side. Two vertices on the 33-side have degree sum 4+4=8≥74 + 4 = 8 \ge 7: fine. But two vertices on the 44-side have degree sum 3+3=6<73 + 3 = 6 < 7: this pair violates Ore's hypothesis, so the theorem simply does not apply — it neither confirms nor (on its own) rules out a Hamiltonian cycle. The direct parity argument from Section 3 is what actually proves K3,4K_{3,4} has none; Ore's theorem only explains why no density argument could have shortcut that proof.

Side note
Where it goes wrong

Treating Dirac's or Ore's theorem as an if-and-only-if. The cycle graph CnC_n (for any n≥5n \ge 5) is a Hamiltonian cycle by definition, yet every vertex has degree 22, far below n/2n/2: Dirac's hypothesis fails completely, but the conclusion is still true. A failed hypothesis gives no information either way; only a satisfied hypothesis guarantees the cycle.

Try it
Try it: does Dirac apply to the Petersen graph?

The Petersen graph has 1010 vertices, each of degree 33. Does Dirac's theorem guarantee it has a Hamiltonian cycle?

Show the answer

No: Dirac's theorem needs every degree ≥n/2=5\ge n/2 = 5, but every vertex here has degree 3<53 < 5, so the hypothesis fails and the theorem gives no conclusion at all. (It happens that the Petersen graph truly has no Hamiltonian cycle — one of the most famous such graphs — but that has to be shown directly, not from Dirac's theorem.) The answer is no guarantee either way\mathbf{\text{no guarantee either way}}.

Gray Codes and Tours

Concept
Gray codes as Hamiltonian cycles

A (cyclic) Gray code on nn bits lists all 2n2^n bit-strings so that consecutive strings — including the last back to the first — differ in exactly one bit. This is exactly a Hamiltonian cycle on the hypercube graph QnQ_n, whose 2n2^n vertices are the nn-bit strings, joined by an edge whenever they differ in one bit.

Gray codes matter outside graph theory too — rotary position encoders and error-resistant digital counters use them so that a single misread bit changes the reading by only one step, not an unpredictable jump. The question "does QnQ_n have a Hamiltonian cycle?" could be attacked with Dirac's theorem (QnQ_n is nn-regular on 2n2^n vertices, and n≥2n/2n \ge 2^n/2 only for tiny nn, so Dirac's theorem is useless here for large nn), but a direct, explicit construction works for every nn: the reflected binary Gray code, built recursively by writing the code for n−1n-1 bits twice, prefixing 00 to the first copy and 11 to the reverse of the second. Reversing the second copy is exactly what keeps the one-bit-change property across the "seam" in the middle, and matching it back to the start of the first copy keeps the whole thing cyclic.

Example
The Gray code for n=3n = 3: a Hamiltonian cycle on the cube
100101110111000001011010
The bold path is the n = 3 Gray code, a Hamiltonian cycle on the cube.

The cube graph Q3Q_3 has 88 vertices (the 33-bit strings), each of degree 33 (flip any one of 33 bits), 1212 edges. Building from G(2)=00,01,11,10G(2) = 00, 01, 11, 10 by the reflect-and-prefix rule: prefix 00 to G(2)G(2), then prefix 11 to G(2)G(2) reversed (10,11,01,0010, 11, 01, 00), giving

G(3)=000,001,011,010,110,111,101,100.G(3) = 000, 001, 011, 010, 110, 111, 101, 100.

Each consecutive pair differs in exactly one bit (check 010→110010\to110: only the leftmost bit changes), and the last, 100100, differs from the first, 000000, in exactly one bit too — a genuine Hamiltonian cycle on Q3Q_3.

Example
Building G(4)G(4) from G(3)G(3)

Apply the same rule once more. Prefixing 00 to every string of G(3)G(3) gives the first 88 codewords; reversing G(3)G(3) to 100,101,111,110,010,011,001,000100, 101, 111, 110, 010, 011, 001, 000 and prefixing 11 gives the last 88:

G(4)=0000,0001,0011,0010,0110,0111,0101,0100,1100,1101,1111,1110,1010,1011,1001,1000.G(4) = \begin{smallmatrix}0000,&0001,&0011,&0010,&0110,&0111,&0101,&0100,\\1100,&1101,&1111,&1110,&1010,&1011,&1001,&1000\end{smallmatrix}.

This lists all 1616 strings of 44 bits exactly once, consecutive strings always differ in one bit (the rule guarantees it at every step, including the jump from 01000100 to 11001100, which only flips the leftmost bit), and the last, 10001000, differs from the first, 00000000, in one bit as well.

Side note
Where it goes wrong

Assuming any sequence of one-bit flips that never immediately repeats a string will eventually cover all 2n2^n of them. Starting from 000000 and flipping greedily,

000→100→110→111→011→001→101,000\to100\to110\to111\to011\to001\to101,

every step changes one bit and no string repeats, yet this path is stuck: from 101101, the only one-bit flips reach 001,111,100001, 111, 100, all already visited, and 010010 is never reached at all. A valid one-bit-flip path can dead-end long before covering every vertex; only a systematic rule like the reflect-and-prefix construction is guaranteed to reach all 2n2^n strings.

Try it
Try it: the first and last codewords

For the n=3n = 3 Gray code G(3)=000,001,011,010,110,111,101,100G(3) = 000, 001, 011, 010, 110, 111, 101, 100, treated as a cycle (not just a list), how many bits apart are the first and last codewords?

Show the answer

The first codeword is 000000 and the last is 100100; they differ only in the leftmost bit, so the Hamming distance is 1\mathbf{1}. This is exactly what makes G(3)G(3) a Hamiltonian cycle on Q3Q_3 rather than just a Hamiltonian path: the construction closes up because the two halves it is built from, 0⋅G(2)0 \cdot G(2) and 1⋅reverse(G(2))1\cdot\text{reverse}(G(2)), meet at matching endpoints on both seams.

Why It Works

Necessity was shown in Section 1: in any trail, every visit to a vertex other than its two ends uses up exactly two edges there, so only the two end-vertices (one, if it is a circuit, where they coincide) can have an odd number of trail-edges; all other vertices must be even. For sufficiency, let GG be connected with every degree even, and let WW be a trail in GG of maximum length (such WW exists since GG is finite). First, WW must be a circuit: if it ended at v≠v \ne start, every time WW passed through vv it used two of vv's edges, plus one more to arrive the last time, an odd total; but deg⁡(v)\deg(v) is even, so some edge at vv is still unused, and appending it would make WW longer, contradicting maximality. So WW is a circuit. Suppose WW does not use every edge of GG. Since GG is connected, some vertex uu on WW has an edge ee not in WW (otherwise the unused edges would form a separate component). Walking WW from uu back to uu, then crossing ee and continuing, extends WW to a longer trail unless ee immediately dead-ends — but the same even-degree argument at the far end of ee shows the walk can always be continued (and, since GG is finite, must eventually return to close a circuit through the unused edges, which splices into WW at uu). This contradicts maximality, so WW already uses every edge: WW is an Euler circuit. For the trail case (exactly two odd vertices s,ts, t): add a phantom edge stst; every degree is now even, so by the circuit case there is an Euler circuit of G+stG + st, and deleting the edge stst from it leaves an Euler trail of GG from ss to tt.

Let GG have n≥3n \ge 3 vertices with deg⁡(u)+deg⁡(v)≥n\deg(u) + \deg(v) \ge n for every non-adjacent pair u,vu, v. Adding an edge to GG can only increase degrees, so this condition still holds for any graph H⊇GH \supseteq G on the same vertices. Suppose, for contradiction, that GG has no Hamiltonian cycle. Add edges to GG, one at a time, keeping the graph non-Hamiltonian, until no more can be added without creating one; call the result HH. HH is not complete (else H=KnH = K_n would trivially be Hamiltonian for n≥3n \ge 3), so some pair u,vu, v is still non-adjacent in HH, and by maximality H+uvH + uv has a Hamiltonian cycle. That cycle must use the edge uvuv (otherwise it would already be a Hamiltonian cycle of HH), so deleting uvuv from it leaves a Hamiltonian path of HH, v1=u,v2,…,vn=vv_1 = u, v_2, \ldots, v_n = v. Let A={i∈{1,…,n−2}:u is adjacent to vi+1 in H}A = \{i \in \{1,\ldots,n-2\} : u \text{ is adjacent to } v_{i+1} \text{ in } H\} and B={i∈{1,…,n−2}:v is adjacent to vi in H}B = \{i \in \{1,\ldots,n-2\} : v \text{ is adjacent to } v_i \text{ in } H\}; since u,vu, v are non-adjacent, ∣A∣=deg⁡H(u)|A| = \deg_H(u) and ∣B∣=deg⁡H(v)|B| = \deg_H(v) exactly (every neighbor of uu other than vnv_n is some vi+1v_{i+1} with i≤n−2i \le n - 2, and symmetrically for vv). Both A,B⊆{1,…,n−2}A, B \subseteq \{1,\ldots,n-2\}, so if they were disjoint, ∣A∣+∣B∣≤n−2|A| + |B| \le n - 2; but ∣A∣+∣B∣=deg⁡H(u)+deg⁡H(v)≥deg⁡G(u)+deg⁡G(v)≥n|A| + |B| = \deg_H(u) + \deg_H(v) \ge \deg_G(u) + \deg_G(v) \ge n, so A∩B≠∅A \cap B \ne \varnothing. Take ii in both: uu is adjacent to vi+1v_{i+1} and vv is adjacent to viv_i. Then

v1 v2⋯vi vn vn−1⋯vi+1 v1v_1\, v_2 \cdots v_i\, v_n\, v_{n-1} \cdots v_{i+1}\, v_1

is a Hamiltonian cycle of HH, using only the original path edges together with vivnv_iv_n and vi+1v1v_{i+1}v_1 — never the added edge uvuv. This contradicts HH being non-Hamiltonian, so the assumption that GG has no Hamiltonian cycle was false.

If every vertex of GG (on n≥3n \ge 3 vertices) has degree ≥n/2\ge n/2, then for ANY two vertices u,vu, v — adjacent or not — deg⁡(u)+deg⁡(v)≥n/2+n/2=n\deg(u) + \deg(v) \ge n/2 + n/2 = n. In particular this holds for every non-adjacent pair, which is exactly Ore's hypothesis; Ore's theorem then gives a Hamiltonian cycle. So Dirac's theorem is the special case of Ore's where the degree bound is enforced on every vertex individually rather than only on non-adjacent pairs.