Eulerian trails and circuits
Find out when a route can cover every road exactly once in Year 12 VCE General Mathematics. Postal workers, street sweepers and council garbage trucks all want to travel each street without doubling back. Leonhard Euler cracked this puzzle in 1736 with the bridges of KΓΆnigsberg, and his idea still plans collection runs in towns from Wodonga to Warrnambool.
You will learn what Eulerian trails and Eulerian circuits are and use the degrees of the vertices to decide which one a graph has, if any. You will write trails, find where they must start, avoid crossing bridges too early, and work out the shortest total distance when part of a route has to be repeated. Next, Hamiltonian paths switch the focus from edges to vertices.
Theory
An Eulerian trail uses every edge of a graph exactly once, and an Eulerian circuit also returns to its start. This Year 12 General Mathematics guide for students in Victoria shows how the degrees of the vertices decide which of these a graph has, and how to solve practical problems where every road or track must be covered.
An Eulerian trail is a trail that uses every edge of a graph exactly once. Vertices may be visited more than once, but no edge is repeated or missed. An Eulerian circuit is an Eulerian trail that finishes at the vertex where it started.
The degrees decide everything. Each time a trail passes through a vertex it uses two edges there (one in, one out), so a vertex in the middle of the trail needs even degree. Only the start and finish of a trail that does not return to its start can be odd. So a graph with exactly two odd vertices has Eulerian trails, but each one must start at one odd vertex and finish at the other, and there is no Eulerian circuit.
The idea began with the bridges of KΓΆnigsberg: seven bridges joined four parts of a city, and the locals asked whether a walk could cross every bridge exactly once. Euler showed it could not, because all four land masses had odd degree. While building a route, avoid crossing a bridge of the graph still to be travelled (an edge whose removal would cut you off from unused edges) unless there is no other choice.
The number of odd vertices is always even, because the degrees add to twice the number of edges:
The conditions for a connected graph:
| Connected graph with | Eulerian circuit? | Eulerian trail? |
|---|---|---|
| 0 odd vertices | yes, from any vertex | yes (the circuit) |
| 2 odd vertices | no | yes, from one odd vertex to the other |
| 4, 6, ... odd vertices | no | no |
In a practical problem where every road must be travelled once:
How to decide and find an Eulerian trail or circuit
- Check the graph is connected. If some edges cannot be reached, no single trail can use them all.
- Find every degree and count the odd vertices: \(0\) gives an Eulerian circuit, \(2\) gives an Eulerian trail (but no circuit), more gives neither.
- Build the route. Start at any vertex (circuit) or at one odd vertex (trail). Cross out each edge as you use it, and do not cross a bridge of the edges still unused unless you have to.
- Check. The route should list one more vertex than there are edges, and every edge should be crossed out exactly once.
Find every degree first.
| \(\text{degrees}\) | \(:\) | \(A{:}\ 2,\ B{:}\ 4,\ C{:}\ 2,\ D{:}\ 4,\ E{:}\ 2,\ F{:}\ 4\) |
| \(\text{odd vertices}\) | \(:\) | \(\text{none}\) |
| \(\text{edges}\) | \(=\) | \(9\) |
The graph is connected and every degree is even, so it has an Eulerian circuit. One is \(A\text{β}B\text{β}C\text{β}D\text{β}B\text{β}F\text{β}D\text{β}E\text{β}F\text{β}A\). It lists \(10\) vertices for \(9\) edges, and uses each edge once.
Count the odd vertices.
| \(\text{degrees}\) | \(:\) | \(P{:}\ 3,\ Q{:}\ 2,\ R{:}\ 4,\ S{:}\ 3,\ T{:}\ 2\) |
| \(\text{odd vertices}\) | \(:\) | \(P,\ S\) |
The graph is connected with exactly two odd vertices, \(P\) and \(S\), so it has an Eulerian trail but no Eulerian circuit. A trail must start at one odd vertex and finish at the other, for example \(P\text{β}Q\text{β}R\text{β}P\text{β}S\text{β}R\text{β}T\text{β}S\).
Every street is driven once (total of all weights). Then the truck must repeat a route between the two odd vertices.
| \(\text{total of streets}\) | \(=\) | \(1.2 + 1.5 + 2.0 + 3.0 + 1.6 + 1.8\) |
| \(\) | \(=\) | \(11.1\ \text{km}\) |
| \(\text{odd vertices}\) | \(:\) | \(A\ (3),\ D\ (3)\) |
| \(A\text{β}D\) | \(:\) | \(3.0\ \text{km}\) |
| \(A\text{β}R\text{β}D\) | \(:\) | \(1.2 + 1.5 = 2.7\ \text{km}\) |
| \(A\text{β}B\text{β}C\text{β}D\) | \(:\) | \(2.0 + 1.6 + 1.8 = 5.4\ \text{km}\) |
| \(\text{total distance}\) | \(=\) | \(11.1 + 2.7\) |
| \(\) | \(=\) | \(13.8\ \text{km}\) |
There are two odd vertices, \(A\) and \(D\), so there is no Eulerian circuit: the sweeper cannot cover every street once and get back to \(R\). It repeats the shortest path between \(A\) and \(D\), which is \(A\text{β}R\text{β}D\), not the direct street. The shortest total is 13.8 km.
(i) Count the odd vertices.
| \(\text{degrees}\) | \(:\) | \(A{:}\ 3,\ B{:}\ 2,\ C{:}\ 3,\ D{:}\ 3,\ E{:}\ 2,\ F{:}\ 3\) |
| \(\text{odd vertices}\) | \(:\) | \(A,\ C,\ D,\ F\ (4)\) |
(i) No. There are four odd vertices, so there is no Eulerian trail.
| \(\deg(A)\) | \(=\) | \(3 + 1 = 4\) |
| \(\deg(D)\) | \(=\) | \(3 + 1 = 4\) |
| \(\text{odd vertices}\) | \(:\) | \(C,\ F\ (2)\) |
(ii) The new track makes \(A\) and \(D\) even, leaving only \(C\) and \(F\) odd. The graph now has an Eulerian trail, so the guide can walk every track once, from \(C\) to \(F\): for example \(C\text{β}A\text{β}B\text{β}C\text{β}D\text{β}A\text{β}F\text{β}D\text{β}E\text{β}F\).
Common pitfalls
Frequently asked questions
What is an Eulerian trail?
An Eulerian trail is a route through a graph that uses every edge exactly once. It may pass through a vertex more than once. If it finishes where it started, it is an Eulerian circuit.
How do you know if a graph has an Eulerian circuit?
The graph must be connected and every vertex must have even degree. Then an Eulerian circuit exists, and it can start at any vertex.
When does a graph have an Eulerian trail but no Eulerian circuit?
When the graph is connected and exactly two vertices have odd degree. Every Eulerian trail then starts at one of the odd vertices and finishes at the other.
What were the bridges of Konigsberg?
Seven bridges joined four parts of the city of Konigsberg. Euler showed that no walk could cross every bridge exactly once, because all four parts had an odd number of bridges, and that started graph theory.
Can a graph have exactly one odd vertex?
No. The degrees always add to twice the number of edges, which is even, so the number of odd vertices is always even: 0, 2, 4 and so on.
What is the difference between Eulerian and Hamiltonian?
Eulerian is about edges: use every edge exactly once. Hamiltonian is about vertices: visit every vertex exactly once. Eulerian questions are decided by the degrees; Hamiltonian ones are found by trial and error.