Königsberg, Prussia · a Sunday afternoon in 1735 · you have seven bridges to cross
The church bells have just finished ringing. You step out of your doorway in Königsberg, Prussia, into the honey-colored light of a Sunday afternoon in 1735, and the whole city seems to be doing exactly what you are doing: going for a walk. Merchants in their best coats. Children racing hoops along the quay. Down the street, an eleven-year-old named Immanuel Kant is probably being told to keep up.
Your city is built on a river called the Pregel, and the river splits it into four pieces of land: the old town on the north bank, the newer district on the south bank, and two islands in the middle — little Kneiphof, crowned by its great brick cathedral, and long, marshy Lomse to the east.
Seven bridges stitch the four pieces together, and every citizen knows them by name, the way you know the names of streets: the Blacksmith's bridge, the Merchant's bridge, the Green bridge, the Giblets bridge (yes, really — it led to the butchers' quarter), the Wooden bridge, the High bridge, and the Honey bridge.
Today, it's your turn. The map below is the city as Euler sketched it. Tap a glowing bridge to cross it. Cross all seven — if you can.
Frustrated? So was everyone in Königsberg. Eventually the puzzle traveled up the Baltic coast to Danzig, where the mayor, Carl Leonhard Gottlieb Ehler, decided to ask the sharpest mathematical mind in Europe: a 28-year-old Swiss prodigy in St. Petersburg named Leonhard Euler.
Euler's first reaction? Basically: why are you bothering me with this?
"Thus you see, most noble Sir, how this type of solution bears little relationship to mathematics... for the solution is based on reason alone, and its discovery does not depend on any mathematical principle."
— Euler to Mayor Ehler, 1736
And to his friend, the astronomer Giovanni Marinoni in Vienna, he grumbled that the question was "so banal." But — and this is the part to remember — he couldn't put it down. Because something about it itched. "It seemed to me worthy of attention," he admitted in the same breath, "in that neither geometry, nor algebra, nor even the art of counting was sufficient to solve it."
Think about that. Here was the greatest calculator alive, and none of the mathematics that existed in 1736 — none of it — could even describe this puzzle about a Sunday stroll. So Euler did what geniuses do when the toolbox is empty. He built a new tool.
Euler's breakthrough was an act of radical forgetting. The cathedral? Doesn't matter. The size of the islands? Doesn't matter. The length of the bridges, the shops, the river's current? None of it matters. The only thing that matters is which pieces of land connect to which — four blobs, seven links.
Drag the slider and watch Königsberg melt into the very first graph: land becomes dots (vertices), bridges become lines (edges).
This little act of squinting — keeping only connections, throwing away everything else — is called abstraction, and this drawing is a graph. The moment Euler drew it, he had invented what we now call graph theory, and planted the seed of topology: the mathematics of connection and shape, where a coffee mug and a donut count as the same thing.
Now the puzzle cracks open with one beautiful observation. Imagine any piece of land that is not where you start or finish your walk. Every time you enter it by one bridge, you must leave by another — bridges get used up in pairs. In, out. In, out.
Now count Königsberg's "doors": North bank 3, South bank 3, Lomse 3, Kneiphof 5. That's four odd land masses. Four is not 0, and four is not 2. The walk you kept attempting above is not just hard — it is impossible, and it always was. No one will ever do it, not with a thousand years of Sundays.
Don't take Euler's word for it — take over the city planning office. In the graph below, tap any bridge to demolish it, tap a dashed route to build a new one, and watch the verdict change:
One bridge is all it takes. Demolish any single bridge (leaving two odd dots) — or build an eighth — and suddenly the famous impossible walk becomes possible. In fact, history ran this experiment: Königsberg is now the Russian city of Kaliningrad, two of the seven bridges did not survive the Second World War, and on today's five-bridge layout an Euler walk finally exists.
Euler presented his solution to the St. Petersburg Academy on August 26, 1735, and published it in a paper with the marvelous title Solutio problematis ad geometriam situs pertinentis — "the solution of a problem relating to the geometry of position." He solved the puzzle and, almost by accident, opened a continent of mathematics no one knew existed.
Every time your map app finds the fastest route through a road network — graph. Every time a package van plans a loop that covers every street without doubling back — that's the Chinese Postman Problem, a direct descendant of the bridges. The internet's cables, your brain's neurons, flight networks, social networks, the way epidemiologists trace an outbreak, the way chemists draw molecules: all graphs, all children of Königsberg.
The mayor of Königsberg has heard you've been walking his bridges all afternoon and asking dangerous mathematical questions. Answer his challenge and earn your title.