Lecture overview
Learning objectives
After this lecture you should be able to:
- 1.Decide from the vertex degrees whether a graph has an Eulerian circuit or trail, and prove why.
- 2.Construct an Eulerian circuit in linear time with Hierholzer’s algorithm.
- 3.State the sufficient conditions of Ore and Dirac for Hamiltonian cycles, and a necessary condition for proving that a graph is not Hamiltonian.
- 4.Explain why the Eulerian problem is easy while the Hamiltonian and travelling salesman problems are NP-hard.
Key Concepts
Eulerian trail · Eulerian circuit · Euler’s theorem · Hierholzer’s algorithm · Hamiltonian cycle · Ore’s theorem · Dirac’s theorem · NP-completeness · Chinese postman
1Introduction
Two questions about a graph look almost identical. Can we travel through it using every edge exactly once? Can we travel through it visiting every vertex exactly once? The first question was answered completely by Leonhard Euler in 1736, in the paper usually taken as the beginning of graph theory. The second looks no harder, yet no efficient answer is known, and it is one of the classic NP-complete problems. This lecture treats both, and the contrast between them is its main lesson.
1.1The Königsberg bridge problem
The Prussian city of Königsberg (today Kaliningrad) stood on both banks of the river Pregel and on two islands, joined by seven bridges. Its citizens asked whether one could take a walk that crosses every bridge exactly once.
Euler replaced each of the four land masses by a vertex and each bridge by an edge. The result is a multigraph with four vertices and seven edges whose degrees are 5, 3, 3 and 3. Euler showed that such a walk is impossible, and his argument gives the rule for every graph, which we prove in Section 2.
1.2Conventions
In this lecture graphs may have parallel edges (as Königsberg does) but no loops. Recall from Lecture 2 that a trail is a walk that repeats no edge and a path is a walk that repeats no vertex. We write n = |V| and m = |E|.

Practice book
Graph Theory Through Problems300 Exercises with Hints, Worked Algorithms and Complete Solutions
By Mohammed Islam Hadjoudj
Learn graph theory by solving problems: 300 exercises, from routine checks to challenging proofs, each with a complete solution.
- Hints for every harder exercise, so you can get unstuck
- Algorithms run by hand, with every step shown in a table
- From trees and matchings to planar graphs and Ramsey theory
Also by the authorGraph Algorithms for Coding Interviews100 solved interview problems with visual explanations and Python solutions.View on AmazonSection 1 of 7