Euler Paths and the Königsberg Bridges

Category: Discrete Math   Level: 301

Euler path exists ⇔ 0 or 2 vertices of odd degree (connected graph)

Turn land into dots and bridges into lines. A walk that crosses every bridge once exists only when zero or two dots have an odd number of lines.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Seven bridges, one walk

Königsberg had four pieces of land joined by seven bridges. The town puzzle: walk across every bridge exactly once. People tried for years. Nobody managed it.

4 land masses, 7 bridges

Step 1: Seven bridges, one walk

Step 2: Turn the map into a graph

Euler kept only what matters. Each piece of land becomes a dot (a vertex) and each bridge becomes a line (an edge). Shape and distance do not matter.

land → vertex, bridge → edge

Step 2: Turn the map into a graph

Step 3: Count the edges at each vertex

The degree of a vertex is how many edges touch it. C has 5, and A, B, and D have 3 each.

deg A = 3, deg B = 3, deg C = 5, deg D = 3

Step 3: Count the edges at each vertex

Step 4: A pass-through uses edges in pairs

Each time the walk passes through a vertex, it uses one edge in and one edge out. So a middle vertex needs an even degree. Only the start and the end may be odd.

pass through: in + out = 2 edges

Step 4: A pass-through uses edges in pairs

Step 5: Four odd vertices: impossible

All four vertices have odd degree. A walk has room for at most two odd vertices, its start and its end. So no walk crosses every bridge once. Euler 1, town 0.

odd vertices: A, B, C, D (4 > 2)

Step 5: Four odd vertices: impossible

Step 6: Add one bridge and it works

An eighth bridge from B to D makes B and D even. Now only A and C are odd, so a walk exists: start at A, end at C, and follow the numbers.

odd vertices: A, C ⇒ Euler path from A to C

Step 6: Add one bridge and it works

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render euler-paths --out /tmp/euler-paths

Source: svgmath/diagrams/graphs.py