Decision Mathematics 1 (Paper 3D or 4D), topic 3 (Algorithms on graphs II), spec point 3.1
The problem
Find the shortest route that travels along every edge at least once and returns to the start. This is also called the Chinese postman problem.
The idea
If every vertex is even, the network is Eulerian and the answer is just the total weight. Otherwise, some edges must be repeated so that every vertex becomes even.
The algorithm
- Find the odd vertices.
- List every way of pairing them, and find the shortest distance between each pair.
- Choose the pairing with the smallest total, and repeat those shortest paths.
- Shortest route length = total weight of the network + that smallest total.
With 4 odd vertices there are 3 pairings. With 6 there are 15, so questions with more than 4 odd vertices give extra information to cut down the pairings.
Worked example
| Edge | AB | AC | AD | BC | BE | CD | DE | DF | EF |
|---|---|---|---|---|---|---|---|---|---|
| Weight | 8 | 6 | 10 | 5 | 9 | 7 | 6 | 3 | 5 |
Total weight 59. Degrees: A 3, B 3, C 3, D 4, E 3, F 2, so the odd vertices are A, B, C and E.
| Pairing | Lengths | Total |
|---|---|---|
| AB + CE | 8 + 13 (C-D-E) | 21 |
| AC + BE | 6 + 9 | 15 |
| AE + BC | 16 + 5 | 21 |
Repeat AC and BE. The shortest route is .
Different start and finish
If the route may start and finish at different vertices, it should start and finish at two of the odd vertices, which then need no repeated path. Only the other two odd vertices are paired. For each choice of start and finish, find the shortest path joining the remaining pair, and choose the smallest.
In the example: start and finish at A and E, repeating BC (5); at B and C, repeating AE (16); at A and C, repeating BE (9); and so on. The best is to start at A and finish at E (or the reverse), repeating BC, for a length of .
Common mistake: repeating the direct edge between two odd vertices when a shorter path exists through other vertices. Always use the shortest path between each pair.
Exam tip: list all three pairings with their totals, even if one is obviously best. State which edges are repeated and the final length.
Check yourself
How many pairings are there for 4 odd vertices?
.
A network has total weight 120 and every vertex is even. Find the route length.
.
Why does a network always have an even number of odd vertices?
The sum of the degrees is twice the number of edges, which is even.