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.
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
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
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
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
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)
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
cd svg-generator python3 -m svgmath render euler-paths --out /tmp/euler-paths
Source: svgmath/diagrams/graphs.py