Nearly three hundred years ago, the city of Königsberg, in Prussia, sat on both banks of the river Pregel. In the middle of the city the river split in two and flowed round an island, Kneiphof, with the cathedral on it; a little farther east the two arms held a second piece of land, Lomse, between them. Seven bridges joined these four pieces of land.
The people of Königsberg liked to puzzle over a question about their city: can you walk through the town and cross every one of the seven bridges exactly once? You may start anywhere and finish anywhere, but you must not cross any bridge twice, and you can only get from one piece of land to another by a bridge. Nobody could find such a walk, and nobody could prove there wasn’t one. Try it yourself.
Try a few starting places, then guess.
Pick an answer to see why.
One stroke of the pen
Many children know a puzzle like the bridges: draw a figure without lifting your pen and without going over any line twice. Lines may cross each other, but you may only turn a corner at a dot.
In Germany children draw a little house this way while chanting Das ist das Haus vom Ni-ko-laus, “This is the house of Nicholas”, one syllable for each of its eight lines. Try it below, then try the other five figures.
Sort the six figures into two groups.
- a.Which figures could you draw? For each one, did you have to start at a particular dot, or did any dot work?
- b.Which figures could you never finish, however you started? How many lines did you manage at most?
- c.Try the house again, starting from one of its top corners, then from the roof. What happens?
What do the special dots have in common? Turn on Count the lines above: it writes beside each dot how many lines meet there.
What is special about the house’s two bottom corners, where the drawing must start and end?
Pick an answer to see why.
Dots and lines: a network
For the bridges puzzle only one thing matters: which pieces of land each bridge joins. The sizes of the island and the river, the lengths of the bridges: none of it changes which walks are possible. So we can shrink each piece of land to a dot and draw each bridge as a line between two dots.
A drawing of dots joined by lines is called a graph or a network. The dots are its vertices (one is a vertex) and the lines are its edges. You met these words for solids in Grade 7: a cube has 8 vertices and 12 edges.
The number of edges that meet at a vertex is its degree. A vertex is odd if its degree is odd, and even if its degree is even.
In Figure 24.2, Kneiphof (A) has 5 bridges, and the north bank (B), the south bank (C) and Lomse (D) have 3 each. All four vertices of Königsberg are odd.
The pen puzzles are networks too, so the bridges and the drawings are the same puzzle. A walk through a network that uses every edge exactly once is called an Euler path (or Euler trail), after the mathematician who solved Königsberg. When it ends where it began, it is an Euler circuit.
In the network of the star in a pentagon, what is the degree of each of its five dots?
Pick an answer to see why.
Why the odd vertices decide
Pick a vertex that is not where the walk starts or ends: one you only pass through. Every time you arrive there by one edge, you leave by another. So each visit uses up two of its edges, one in and one out.
If the walk uses every edge exactly once, such a vertex has all its edges used in pairs, so its degree must be even: 2 if you pass once, 4 if you pass twice, and so on.
The two ends are different. At the start, the first edge is an “out” with no “in” before it; at the finish, the last is an “in” with no “out” after it. So the start and the finish can be odd. If they are the same vertex, its first “out” and last “in” make one more pair, and it is even too.
So a walk that uses every edge exactly once can have at most two odd vertices, and they must be where it starts and where it ends. Königsberg has four odd vertices. Whichever two are the start and the end, the other two would need their bridges in pairs, and 3 bridges can’t be split into pairs. No walk exists. That is the whole proof.
It works the other way round too, and gives a rule for any network:
Euler’s rule. A connected network (one where you can get from any vertex to any other along its edges) has a walk that uses every edge exactly once
- when it has no odd vertices: then you can start anywhere, and you finish where you began (an Euler circuit);
- when it has exactly two odd vertices: then you must start at one of them, and you finish at the other (an Euler path);
- and never when it has more than two odd vertices.
The argument above proves the last line. That the walk really exists in the other two cases took 137 years to prove (see the story below); the next section shows how to find it.
Check it against your six figures:
| Figure | Odd vertices | One stroke? |
|---|---|---|
| Star | 0 | yes, from any dot, back to it |
| Star in a pentagon | 0 | yes, from any dot, back to it |
| House | 2 (the bottom corners, 3 each) | yes, from one bottom corner to the other |
| Two panes | 2 (the middle of the top and bottom, 3 each) | yes, from one to the other |
| Crossed square | 4 (every corner, 3 each) | no |
| Three panes | 4 (the two middle dots of the top and of the bottom) | no |
The handshake fact
Could a network have exactly one odd vertex, a walk with a start but nowhere to end? Try to draw one: you can’t.
Every edge has two ends, so the degrees of all the vertices added together are twice the number of edges, an even number. For Königsberg, 5 + 3 + 3 + 3 = 14 = 2 × 7; for the house, 3 + 3 + 4 + 4 + 2 = 16 = 2 × 8. From this it follows (question e shows how) that every network has an even number of odd vertices: 0, 2, 4, … never 1 or 3. It is called the handshake fact: at any party, the number of guests who shook an odd number of hands is even. Euler proved it in his paper on the bridges.
A network has 9 edges and its vertices have degrees 4, 4, 3, 3, 2 and one more you haven’t counted. What is the missing degree?
Pick an answer to see why.
Finding the walk
Euler’s rule tells you whether a walk exists. When it does, how do you find it without trial and error?
- Count the degrees. If there are two odd vertices, start at one of them. If there are none, start anywhere.
- Draw one edge at a time, from where you are.
- Don’t burn your bridges. If you have a choice, never take an edge that would cut you off from edges you haven’t drawn yet. Take it only when it is the last edge left at your vertex.
Breaking rule 3 is how you get stuck halfway: you cross into one part of the network and can’t get back to the edges left behind.
A bridge more, or two fewer
Euler’s rule also shows how to change a network so a walk exists. A new bridge adds 1 to the degree at both its ends: it turns two vertices from odd to even, or even to odd.
In 1905 Königsberg built an eighth bridge, the Kaiserbrücke (Emperor’s Bridge), from the south bank to Lomse. Count again with it (leaving out the railway bridge built downstream in the 1880s): the south bank and Lomse now have 4 bridges each, so only Kneiphof (5) and the north bank (3) are odd.
Then war changed the puzzle. The city was bombed in 1944 and taken by the Soviet army in 1945; it is now Kaliningrad, in Russia. Two bridges onto Kneiphof were destroyed and never rebuilt. The two westernmost were later replaced by one long road bridge that crosses the island from bank to bank, with a way down onto it. The Honey Bridge between the islands and the Wooden Bridge are still the bridges of Euler’s time; the High Bridge was rebuilt in the 1930s.
Where this is used
Questions
★ Which of these can be drawn in one stroke, without going over a line twice?
Pick an answer to see why.
For each of the networks P, Q and R above, write the degree of every vertex. Then say whether it can be drawn in one stroke and, if so, where you must start and where you will finish.
Hint
Answer
The townspeople of Königsberg in 1736 want to build new bridges so that the walk is possible.
- i.What is the fewest number of new bridges that makes a walk possible? Between which places could it go?
- ii.What is the fewest number of new bridges that makes a round walk possible, one that ends where it began?
Hint
Answer
★★ In 1736, a walk over all seven bridges is impossible. What is the fewest number of bridges a walk must cross twice if it is to cross every bridge at least once?
Pick an answer to see why.
In the made-up village of Figure 24.8, the postman starts at the post office, must walk along every lane at least once, and must come back to the post office. The lanes add up to 1,100 m. What is the shortest walk he can make, and which lanes does he walk twice?
Hint
Answer
A set of dominoes has a tile for every pair of numbers from 0 to 6, doubles included: 28 tiles. Dominoes are laid end to end, touching ends showing the same number. Can all 28 be laid in one closed ring? What about a set from 0 to 5 (21 tiles)? Explain with Euler’s rule.
Hint
Answer
Prove that in any network, the number of odd vertices is even. Then use it to show that at a party, the number of people who shook hands with an odd number of others is even.
Answer
Where to go next
- Can Three Houses Reach Three Wells Without Paths Crossing? Networks again, but now the question is whether they can be drawn on paper with no lines crossing.
- What Is the Quickest Way Across the Map? Networks with a time on every road, and how to find the fastest route without trying them all.
- Why Do Solids Always Obey One Rule? Count the corners, edges and faces of a solid, from Grade 7: another of Euler’s discoveries.
- Can Four Colors Paint Any Map of Nepal? (Computing, Going Further 6–8) A map as a network of neighbors.
- How Many Ways Round Bhaktapur’s Temples? (Computing, Going Further 6–8) A walk that visits every place once, a puzzle that sounds like Euler’s but is far harder.
- Can a Robot Get Out of Any Maze? (Computing, Going Further 6–8) A maze is a network too.
Where these facts come from
- The city, its two islands (Kneiphof and Lomse) and banks, the problem, Euler’s dates (presented 26 August 1735, published 1741), the degrees 5, 3, 3, 3, Hierholzer’s proof, and the state of the bridges today: Wikipedia, “Seven Bridges of Königsberg”, read October 2026.
- Which bridge joined which places, their names, the Kaiserbrücke of 1905 (south bank to Lomse), the railway bridge downstream (first spanned 1884, first train 1889), the road bridge of 1972 in place of the Krämer and Green bridges, the Honey and Wooden bridges surviving: Wikipedia (German), “Königsberger Pregelbrücken” and “Königsberger Brückenproblem”, read October 2026; Euler’s own Fig. 1 on Wikimedia Commons, with the bridges lettered.
- A visit to the bridges in 2000: two from Euler’s time, two replaced by the Leninsky Prospekt road bridge, two destroyed in the war, the High Bridge rebuilt in the 1930s; the 1944 bombing: Peter Taylor, “What Ever Happened to Those Bridges?”, Australian Mathematics Trust, December 2000, read October 2026.
- Ehler’s letter of 9 March 1736 (with Kühn and the sketch), Euler’s letters to Marinoni (13 March 1736, “banal”, neither geometry, algebra nor counting enough) and to Ehler (3 April 1736, reason alone), retold in our words: H. Sachs, M. Stiebitz and R. J. Wilson, “An historical note: Euler’s Königsberg letters”, Journal of Graph Theory 12 (1988) 133–139, read October 2026.
- Euler’s paper (its title, the letters A–D and a–g, his count of 8 places against 9, listing walks too laborious, the sum of degrees twice the bridges, the odd places even in number, doubling every bridge), the volume dated 1736 printed in 1741, Euler probably never visiting Königsberg, Hierholzer (1840–1871) and the 1873 paper written up by Wiener and Lüroth, and Guan Meigu’s problem (1960, aged 26, Shandong Normal University; the 1962 translation; Edmonds’ name for it): M. Grötschel and Y. Yuan, “Euler, Mei-Ko Kwan, Königsberg, and a Chinese Postman”, Documenta Mathematica, Extra Volume ISMP (2012) 43–50, read October 2026; the paper’s record at the Euler Archive (E53).
- Euler’s birth in Basel and his years, 1707–1783: Wikipedia, “Leonhard Euler”, read October 2026.
- Guan Meigu’s names and the problem’s other names: Wikipedia, “Chinese postman problem” and “Meigu Guan”, read October 2026.
- The Chinese postman problem as the basis of route planning for street sweeping and snowplows: Ben Dussault, Modeling and Solving Arc Routing Problems in Street Sweeping and Snow Plowing, University of Maryland, 2012, read October 2026.
- DNA assembly as an Euler path: P. A. Pevzner, H. Tang and M. S. Waterman, “An Eulerian path approach to DNA fragment assembly”, PNAS 98 (2001) 9748–9753 (abstract read October 2026); P. E. C. Compeau, P. A. Pevzner and G. Tesler, “How to apply de Bruijn graphs to genome assembly”, Nature Biotechnology 29 (2011) 987–991 (its title and record on PubMed).
- Das Haus vom Nikolaus, its eight lines and eight syllables, and its 44 drawings from one corner: Wikipedia (German), “Haus vom Nikolaus”, read October 2026.
- Merian’s engraving of Königsberg: Wikimedia Commons, from the Bibliothèque nationale de France.
- Every number in the topic (degrees, which walks exist and from where, 44 ways for the house, 384 and 12 walks, the fewest new bridges, the postman’s 1,390 m, the dominoes) was computed by trying every walk in a program of our own.
