In the 18th-century Prussian city of Königsberg, the Pregel River flowed through the middle of town, with two islands in the middle of the river and 7 bridges in total connecting those islands to each other and to the two riverbanks. Among the townspeople, there was a long-standing question: "Can you cross all 7 bridges, each exactly once, and make it across every single one?" Citizens who loved to stroll actually tried many times, but no one ever succeeded.

In 1736, the mathematician Leonhard Euler gave a definitive answer to this question. But what Euler did wasn't to go cross the bridges himself — he simplified the problem completely. He turned each piece of land (the riverbanks and islands) into a point, and each bridge into a line connecting those points. Drawn this way, the Königsberg problem becomes a "one-stroke drawing" puzzle: "Can you draw this figure without lifting your pencil and without tracing the same line twice?" This idea was the very starting point of the branch of mathematics we now call graph theory.

3 5 3 3 All four landmasses have an odd number of bridges — impossible
The number in each circle is how many bridges connect to that landmass (its degree). 5, 3, 3, 3 — all of them are odd

The key concept here is degree. The number of bridges connected to a point (a piece of land) is called that point's degree. If you pass straight through a point in the middle of drawing your one-stroke path, you always end up pairing up one bridge coming in with one bridge going out. So every point that isn't the start or the end gets its bridges used up two at a time each time you pass through, which means that point's degree must always be even.

A point with an odd degree, on the other hand, can only be one of two things: the starting point where the trip begins (with one outgoing bridge left over) or the ending point where it finishes (with one incoming bridge left over). So the whole graph can have at most 2 odd-degree points. If there are 0 odd-degree points, you can draw the whole thing in one stroke starting anywhere, and even return to your starting point; if there are exactly 2 odd-degree points, it's only possible if you use those two points as your start and end. But if there are 3 or more odd-degree points, there's no way to make every one of them a start or end point, so a one-stroke drawing is flatly impossible.

Königsberg's four landmasses fell squarely into this trap. One island connected to 5 bridges, and the other three landmasses each connected to 3 bridges — 5, 3, 3, 3. All four landmasses have an odd degree. With 4 odd-degree points, no matter how many different orders the townspeople tried, crossing all 7 bridges exactly once each was mathematically impossible from the very start.

From this single problem, Euler created graph theory, the study of relationships made of points and lines, and this idea is now used all over our daily lives. The way map apps find the shortest route, the way social networks analyze friendships, and the way data gets routed across the internet all run on graph theory. A small curiosity among riverside strollers 300 years ago turned out to be the root of technology we use every single day.

On our activity page, you can try the one-stroke drawing yourself by clicking through the actual map of Königsberg's bridges, and practice with other shapes to see for yourself which ones work and which don't. At the end, you can look at a table of each shape's degrees and confirm that just counting the odd-degree points tells you the answer in advance.