The Route Inspection Algorithm
Revise The Route Inspection Algorithm for Further Decision Mathematics 1 WDM11 (AS Level) — revision notes and instant AI marking. Free to start.
The Route Inspection Algorithm
- The Route Inspection Problem (a.k.a. the Chinese Postman Problem) asks for the shortest route that travels along every edge of a graph and returns to the start.
- Whether you need to repeat any edges depends entirely on the degree (order) of each vertex — specifically, how many vertices have an odd degree.
- 0 odd vertices → the graph is Eulerian → no repeats needed at all.
- 2 odd vertices → the graph is semi-Eulerian → you must repeat the shortest path connecting those two odd vertices.
- More than 2 odd vertices (always an even number of them) → you must test every possible way of pairing them up, and repeat whichever pairing gives the smallest total.
- The final answer = (sum of all edge weights in the original graph) + (sum of the weights of the repeated edges).
Picture a real postman. Every morning he has to walk down every road on his route to deliver letters. He starts at the depot, and he has to end back at the depot. Naturally, he wants to walk the shortest possible total distance while still covering every road at least once.
The catch: road networks are messy. Sometimes the layout of roads means it's mathematically impossible to walk every road exactly once and return to the start — some roads will have to be walked twice. The question the algorithm answers is: which roads should be repeated to keep the extra distance as small as possible?
Formal definition
Given a weighted graph, find the route of least total weight that:
- Traverses every edge in the graph at least once, and
- Starts and finishes at the same vertex.
Common variations you might be asked about
- Different start and finish vertices — e.g. a delivery van starts at the depot but ends its shift at home.
- Edges disregarded — e.g. a particular road is closed for roadworks, so it's removed from the graph entirely.
- Routes that require deliberate repetition — e.g. a road-sweeping lorry that has to sweep both sides of every road, meaning every edge is effectively walked twice on purpose (this doubles every edge weight rather than looking for odd vertices).
Everything in this chapter hinges on one very simple first step: for every vertex in the graph, count how many edges are connected to it. This number is called the degree (or order) of the vertex. Then sort vertices into two piles: even degree and odd degree.
Why does this matter so much? Because of a beautiful piece of graph theory (first worked out by Euler himself, hence "Eulerian"): a route that uses every edge exactly once and returns to its start point (called an Eulerian circuit) is only possible if every single vertex has an even degree. If even one vertex has an odd degree, you literally cannot draw that route without retracing a line — it's a mathematical impossibility, not just something that's hard to find.
Why odd vertices force a repeat
Think about walking through a vertex: every time you arrive along one edge, you must leave along a different edge — arrivals and departures use up edges in pairs. If a vertex has an even degree, every visit pairs up perfectly and you can leave the way you haven't been before, right up until the last edge, which brings you home. But if a vertex has an odd degree, at some point you'll arrive and find every other edge already used — except the one that brought you there. You get "stuck" needing to reuse an edge. That's the mathematical root of why odd vertices cause the problem.
A graph has 6 vertices. Four of them have odd degree, two have even degree. Is it possible to find an Eulerian circuit in this graph? Explain your answer.
Explain briefly why the total sum of all vertex degrees in a graph is always double the number of edges.
Case A — 0 odd vertices (the graph is Eulerian)
This is the easy, best-case scenario. If every vertex has even degree, an Eulerian circuit exists — a route that travels along every edge exactly once and returns to the start. No edges need to be repeated at all.
Case B — 2 odd vertices (the graph is semi-Eulerian)
This is where the real "route inspection" thinking kicks in. If exactly two vertices have odd degree, the graph is called semi-Eulerian. This means there's a route that travels every edge exactly once, but it can only do so if it starts at one odd vertex and finishes at the other — not a closed loop.
Two situations can arise here, and it's crucial you spot which one a question is actually asking:
- If the route must start and finish at the SAME vertex (the standard Chinese Postman setup): you cannot avoid repeating something, because a closed route needs every vertex to be even. You must find the shortest path between the two odd vertices and repeat every edge along that path.
- If the route is allowed to start at one odd vertex and finish at the other: no repetition is needed at all! The Eulerian path already exists between those two points.
Worked Example — Cable Network (2 Odd Vertices)
A network shows the distance, in metres, of cables between connection points A, B, C, D, E and F. Every cable must be inspected, and the engineer must start and finish at connection point E.
Step 1 — Inspect the degree of every vertex
| Vertex | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| Degree | 5 (odd) | 2 (even) | 3 (odd) | 2 (even) | 4 (even) | 2 (even) |
Step 2 — Find the shortest path between the odd vertices
There's exactly one pair of odd vertices: A and C. The direct edge AC = 16, but going via B (A→B→C = 9 + 5 = 14) is shorter. So the shortest path between A and C is A–B–C, weight 14, meaning edges AB and BC must be repeated.
Step 3 — Write down an Eulerian circuit of the adjusted graph
One possible route: E F A E D A B A C B C E
Step 4 — Calculate the total
Plus repeated edges (AB + BC) = 9 + 5 = 14
Total shortest route = 73 + 14 = 87 metres
Using the same cable network above, suppose the engineer is now allowed to start at A and finish at C (rather than starting and finishing at the same point). What is the length of the shortest route that inspects every cable?
Real road networks are messy, and it's very common for a graph to have 4 (or more) odd vertices. Remember: it will always be an even number (2, 4, 6...) — never odd — because of the rule from Section 2. When there are more than 2 odd vertices, you can't just pick the obvious pairing — you have to be systematic.
The core idea
With 4 odd vertices — call them P, Q, R and S — you need to pair them up into two pairs, and there are exactly 3 different ways to do this:
- PQ and RS
- PR and QS
- PS and QR
For each of these 3 pairings, you find the shortest path for each pair and add the two path lengths together. Whichever pairing gives the smallest combined total tells you which edges to repeat.
What if there are 6 odd vertices?
In theory you'd need to check 15 different pairings — which is a lot of work by hand! In practice, exam questions with more than 4 odd vertices almost always give you extra information (like specifying different start and end points) that effectively reduces the problem back down to 4 odd vertices, so you rarely need to actually do all 15.
Worked Example — Pothole Inspection (4 Odd Vertices)
The network below shows distances, in km, of main roads between towns A, B, C, D and E. Every road must be inspected for potholes, starting and finishing at town A.
(AE curved top edge = 17 km — labelled above the arc)
Step 1 — Inspect the degree of each vertex
| Vertex | A | B | C | D | E |
|---|---|---|---|---|---|
| Degree | 3 (odd) | 3 (odd) | 3 (odd) | 3 (odd) | 2 (even) |
There are 4 odd vertices: A, B, C, D. So the network does not contain an Eulerian circuit.
Step 2 — List all 3 possible pairings
| Pairing | Shortest path 1 | Shortest path 2 | Total |
|---|---|---|---|
| AB & CD | A–B–D = 12 | CD = 10 | 22 |
| AC & BD | A–D–C = 18 | BD = 4 | 22 |
| AD & BC | AD = 8 | BC = 9 | 17 ✅ smallest |
The smallest combined total comes from pairing AD and BC, so these edges get repeated.
Step 3 — Eulerian circuit of the adjusted graph
One valid route starting and ending at A: A D A B D C B C E A
Step 4 — Calculate the total
Plus repeated edges (AD + BC) = 8 + 9 = 17 km
Total shortest route = 69 + 17 = 86 km
Why wasn't the pairing "AC & BD" (total 22 km) chosen instead of "AD & BC" (total 17 km), even though both are valid ways to pair up the four odd vertices?
Variation A — Choosing your own start and finish points
Sometimes with 4 odd vertices, a question says the route can start and finish at any two of the odd vertices — you get to choose which two, in order to minimise distance. The method changes slightly:
Find the shortest-path length for all 3 possible pairings as before.
Pick the pairing with the smallest length to be the pair that gets repeated.
The other two odd vertices (the ones NOT repeated) become your start and finish points for the route.
Variation B — Different weight for first pass vs. repeat pass
In some real-world contexts (e.g. inspecting a pipeline for defects), travelling an edge for the first time might take longer than travelling it again just to "pass through" it (perhaps because the first pass involves careful inspection, while the second pass is just transit). If a question gives you two different weights for an edge — one for "first traversal" and one for "repeat traversal" — make sure you use the correct one at the correct stage of your working. Don't just double the same number if the question specifies otherwise!
Variation C — Roads that must be doubled deliberately
A road-sweeper or line-painter often has to cover both sides of every road. In this case, every edge is effectively duplicated from the start — you're not looking for odd vertices at all, because after duplicating every edge, every vertex's degree automatically doubles and becomes even. The route length is simply 2 × (sum of all edge weights).
Key Terms
| Term | Meaning |
|---|---|
| Route Inspection Problem / Chinese Postman Problem | Finding the shortest closed route that covers every edge of a graph at least once. |
| Degree (Order) of a vertex | The number of edges connected to that vertex. |
| Eulerian graph | A graph where every vertex has even degree (0 odd vertices) — has a closed route using every edge exactly once. |
| Eulerian circuit | A route that starts and ends at the same vertex, using every edge exactly once (only possible in Eulerian graphs). |
| Semi-Eulerian graph | A graph with exactly 2 odd vertices — has an open route (not closed) using every edge exactly once, between the two odd vertices. |
| Odd vertex / Odd node | A vertex with an odd number of edges connected to it — the "problem points" of the graph. |
Formulas at a Glance
The 4-Step Method (memorise this order!)
Inspect the degree of every vertex; identify the odd ones.
If 0 odd → skip to Step 4. If 2 odd → find shortest path between them. If 4+ odd → list all possible pairings.
Find the shortest route (by inspection) for each pairing; add the cheapest set of repeated edges to the graph.
Write down an Eulerian circuit of the adjusted graph; sum all edges traversed (original + repeats) for the total weight.
- Clearly stated degree/order of every vertex (show your working, don't just state "4 odd vertices").
- All possible pairings tested explicitly when there are more than 2 odd vertices.
- A valid Eulerian circuit written out as a sequence of vertices (there's usually more than one correct answer — any valid one gets the marks).
- A final numeric answer with correct units, clearly showing (sum of edges) + (sum of repeats).
Read the full The Route Inspection Algorithm notes free
That's the preview — create a free account to read the rest, plus flashcards and practice questions with instant AI marking. No credit card.
Unlock the full notes free →