Euler and Hamilton Paths
An Euler circuit crosses every edge exactly once and ends where it started. Every time you pass through a vertex you use one edge in and one edge out, so it exists exactly when the graph is connected and every degree is even. Visiting every vertex once instead (a Hamilton cycle) sounds similar, but no simple test for it is known.
What the symbols mean
- Degree
How many edge-ends meet at v.
Explanation
An Euler circuit is simply a route that travels every road (edge) exactly once and comes back home, like drawing a figure without lifting your pen or going over a line twice. It's named after Leonhard Euler, who solved the first problem of this kind, and it's good for planning any route that has to cover every street: snowplows, mail carriers, street sweepers. The rule looks formal, but it's only two checks: "connected" (you can get everywhere) and " is even for every vertex" (every intersection has an even number of roads). If both hold, a circuit exists; if either fails, it doesn't. That's the whole test.
In 1736 Euler was asked whether you could walk through the city of Königsberg crossing each of its seven bridges exactly once. People had tried and failed, but nobody knew whether it was impossible. Euler's insight was that the shapes and distances don't matter at all, only what connects to what. Make each land mass a vertex and each bridge an edge, and the degrees are 5, 3, 3 and 3. That one move invented graph theory.
Why degrees decide. Follow an Euler circuit and watch any one vertex. Every time the route passes through, it comes in along one edge and leaves along another, so it uses up edges at that vertex in pairs. The start works the same way, since the circuit leaves it at the beginning and comes back at the end. So every degree has to be even. Euler showed the converse too: in a connected graph with all degrees even, you can always find such a circuit.
Euler paths don't have to return to the start, and that loosens things just enough. The start and end vertices are the only places where an edge isn't paired with another, so they're allowed to be odd. Euler paths exist exactly when there are 0 or 2 odd-degree vertices, and with 2, the path starts at one and ends at the other. Königsberg has 4 odd vertices, so no walk works.
Hamilton cycles visit every vertex once instead. They sound like the same kind of problem but are much harder: no efficient test is known, and finding the shortest one is the traveling salesman problem. A useful sufficient condition is Dirac's theorem: if every vertex of an -vertex graph () has degree at least , a Hamilton cycle exists.
A common mistake. It's tempting to mix up the two: Euler is about edges (every road once), Hamilton is about vertices (every town once). And Dirac's theorem only works one way. A graph can fail it and still have a Hamilton cycle; the cycle has every degree 2, below , and it is a Hamilton cycle.
See it
Worked examples
Does a connected graph with degrees have an Euler circuit? An Euler path?
- 1
The two vertices of degree 3 are odd; the rest are even.
Practice
Type your answer and check it. Solve them all to complete the lesson.
Königsberg's land masses have degrees 5, 3, 3 and 3. How many vertices have odd degree?
What is the fewest number of bridges that must be added to Königsberg to allow an Euler path?
Does have an Euler circuit?
Which problem has no known efficient algorithm?
A mail carrier wants to walk every street in a neighborhood exactly once and end back at the post office. The intersections have degrees 2, 4, 3, 3, 2 and 4, and the streets are connected. Is it possible?
A connected graph has degrees 4, 4, 2, 2, 2 and 2. How many edges does it have?
The hardest one here. Get it, and you've got this lesson.
How many different Hamilton cycles does have? Count a cycle and its reverse as the same, and don't care where it starts.
Where it's used
Snowplows, street sweepers and mail carriers plan Euler-style routes that cover every street; delivery companies face the much harder Hamilton-style traveling salesman problem.