Lesson 33 +35 XP

Euler and Hamiltonian Paths & Circuits

1. The Königsberg Bridge Problem

The city of Königsberg had 4 land masses joined by 7 bridges. Can you walk across every bridge exactly once and return home? Euler (1736) modelled land as vertices and bridges as edges-the birth of graph theory. The degrees are 3, 3, 3, 5-all odd-so no such walk exists.

Königsberg bridges as a multigraph; odd degrees make an Euler circuit impossibleKönigsberg bridges as a multigraph; odd degrees make an Euler circuit impossible

2. Euler Paths and Circuits

  • Euler circuit: a circuit that uses every edge exactly once.
  • Euler path (trail): a path/trail that uses every edge exactly once (start ≠ end allowed).

Euler's Theorem. A connected (multi)graph with at least two vertices has an Euler circuit iff every vertex has even degree. It has an Euler path but no Euler circuit iff it has exactly two vertices of odd degree - the path must start at one and end at the other.

Proof sketch (⇒). Each time the circuit passes through a vertex it uses one edge in and one edge out, contributing 2 to the degree; the start/end vertex also gets 2 (first out, last in). So all degrees are even.

Proof sketch (⇐, Hierholzer's construction). Start anywhere and walk along unused edges. Because all degrees are even you can only get stuck back at the start, giving a circuit C. If C misses edges, some vertex on C has an unused edge (connectedness); build another circuit from there and splice it into C. Repeat until all edges are used. ∎

GraphOdd-degree verticesEuler circuit?Euler path?
Kₙ, n odd0✅✅
Kₙ, n even (n > 2)n❌❌
Cₙ0✅✅
Kₘ,ₙ, m, n both even0✅✅
"Open envelope" (house with crossed square)2❌✅
Königsberg4❌❌

Fleury's algorithm (finding the circuit): start at a vertex (an odd one, for a path); at each step choose an unused edge, never crossing a bridge of the remaining graph unless there is no other choice; delete edges as you go.

Directed version. A connected digraph has an Euler circuit iff deg⁻(v) = deg⁺(v) for every v.

Applications: route inspection (snow ploughs, postmen-the Chinese postman problem), DNA fragment assembly, drawing a figure without lifting the pen.

3. Hamiltonian Paths and Circuits

  • Hamiltonian circuit: a cycle that visits every vertex exactly once (and returns).
  • Hamiltonian path: a path visiting every vertex exactly once.

Euler vs Hamiltonian: every edge once vs every vertex onceEuler vs Hamiltonian: every edge once vs every vertex once

Unlike the Euler case, there is no simple necessary-and-sufficient test - deciding Hamiltonicity is NP-complete. We have sufficient conditions:

Dirac's Theorem. If G is simple with n ≥ 3 vertices and deg(v) ≥ n/2 for every v, then G has a Hamiltonian circuit. Ore's Theorem. If G is simple with n ≥ 3 vertices and deg(u) + deg(v) ≥ n for every pair of non-adjacent u, v, then G has a Hamiltonian circuit.

These are sufficient but not necessary: C₆ is Hamiltonian although every degree is 2 < 3.

Useful facts

  • Kₙ (n ≥ 3) is Hamiltonian; it has (n − 1)!/2 distinct Hamiltonian circuits.
  • Kₘ,ₙ is Hamiltonian iff m = n ≥ 2.
  • A graph with a cut vertex or a pendant vertex has no Hamiltonian circuit.
  • Qₙ (n ≥ 2) is Hamiltonian-a Hamiltonian circuit of Qₙ is a Gray code.
  • The Petersen graph has a Hamiltonian path but no Hamiltonian circuit.

Rules for showing a graph is NOT Hamiltonian: a degree-2 vertex forces both its edges into the circuit; a circuit cannot use more than 2 edges at a vertex; it cannot close a smaller cycle early. Contradictions among these forced edges prove non-Hamiltonicity.

4. Euler vs Hamilton

EulerHamilton
Visits everyedge exactly oncevertex exactly once
Characterisationall degrees even (circuit) / exactly 2 odd (path)none known (NP-complete)
AlgorithmFleury / Hierholzer in O(E)backtracking, exponential
Applicationroute inspectionTravelling Salesman (Lesson 39)
🎯 END-TERM EXAM PREP

📝 IPU End-Term Exam Corner (5-10 Marks)

  • Q1. State and prove the necessary and sufficient condition for an Euler circuit. Explain the Königsberg bridge problem. (10 Marks)
  • Q2. Differentiate Euler and Hamiltonian circuits with examples of a graph that is (i) both (ii) Euler only (iii) Hamiltonian only (iv) neither. (5 Marks)
  • Write: (i) C₅ (ii) two triangles sharing a vertex ("bow-tie") (iii) K₄ (iv) a path with a pendant branch / K₁,₃.
  • Q3. State Dirac's and Ore's theorems. For which m, n does Kₘ,ₙ have an Euler circuit? A Hamiltonian circuit? (5 Marks) → both even; m = n ≥ 2.