Eulerian trails and circuits
Find out when a route can cover every road exactly once in Year 12 General Mathematics for Queensland (QCAA). 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 Cairns to the Gold Coast.
You will learn what Eulerian trails and circuits are and use the degrees of the vertices to decide whether a graph is Eulerian, semi-Eulerian or neither. You will write trails, find where they must start, 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 Queensland students shows how the degrees of the vertices decide whether a graph is Eulerian or semi-Eulerian, 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.
A connected graph that has an Eulerian circuit is an Eulerian graph. A connected graph that has an Eulerian trail but no Eulerian circuit is a semi-Eulerian graph. Its Eulerian trails must start at one vertex of odd degree and finish at the other.
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 an open trail can be odd.
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 | Type | Eulerian trail? |
|---|---|---|
| 0 odd vertices | Eulerian | a circuit, from any vertex |
| 2 odd vertices | semi-Eulerian | an open trail from one odd vertex to the other |
| 4, 6, ... odd vertices | neither | none |
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 a circuit, \(2\) gives an open trail, 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 avoid using an edge that would cut you off from edges not yet used.
- 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 is Eulerian. One circuit 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 is semi-Eulerian. A trail must start at one and finish at the other, for example \(P\text{-}Q\text{-}R\text{-}P\text{-}S\text{-}R\text{-}T\text{-}S\). There is no Eulerian circuit.
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}\) |
The graph is semi-Eulerian (odd vertices \(A\) and \(D\)), so the truck 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 becomes semi-Eulerian, 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.
What is a semi-Eulerian graph?
It is a connected graph with an Eulerian trail but no Eulerian circuit. This happens exactly when the graph has two vertices of odd degree. The trail starts at one of them and ends at the other.
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.