Maths › Decision Mathematics 1 › Route inspection

Route inspection

The route inspection problem asks for the shortest closed route that uses every arc of a connected network at least once. Odd nodes force some arcs to be repeated: pair the odd nodes, repeat a shortest path between each pair, and add the least pairing cost to the total edge weight.

Builds on Shortest paths: Dijkstra and Floyd and Graphs: order, Eulerian paths and planarity.

IN THIS TOPIC

  • Identify the odd nodes and list every possible pairing of them.
  • Count the pairings of 2n odd nodes as the product of the odd numbers up to 2n − 1.
  • Find the shortest path between each pair and choose the cheapest pairing.
  • State the length of the shortest closed route and which edges are repeated.
  • Adapt the method when the route need not return to the start.
  • Say what a network model assumed, and rework the answer when a road closes or a weight is revised.

COMMON MISCONCEPTION

In route inspection you repeat the shortest edges in the network until every node has even order.

Only the odd nodes are paired up, and what is repeated between each pair is a shortest path, which may run through several edges and past other nodes. Repeating an edge between two even nodes turns both of them odd and makes matters worse. Four odd nodes give three pairings and six give fifteen, and the answer is the total weight of the network plus the cheapest pairing.

Why edges have to be repeated

Take the network to be connected: no closed route covers every edge of a disconnected network. A closed route using every edge exactly once then exists only when every node has even order, since each visit to a node uses two of its edges. Odd nodes therefore force repetition, and repeating an edge amounts to adding a duplicate, which raises the order of both its ends by one.

So the job is to pair up the odd nodes and repeat a shortest path between each pair. Shortest path, not shortest edge. The shortest path between two odd nodes may run through several edges and past other nodes, and repeating an edge between two even nodes would only make matters worse by turning them odd.

Three rows, one for each way of pairing the four odd nodes. The pairing of A with B and D with E costs fourteen, less than the other two, so those routes are the ones repeated.
FIG. 1The three possible pairings of four odd nodes, with their costs and the cheapest picked out.

WORKED EXAMPLE

Choosing the pairing

The network's odd nodes are A, B, D and E, with shortest paths AB 5, AD 9, AE 13, BD 7, BE 9, DE 9. Find the cheapest pairing.

There are three ways to pair four nodes.

AB with DE: 5 + 9 = 14.

AD with BE: 9 + 9 = 18. AE with BD: 13 + 7 = 20.

The cheapest is AB and DE, adding 14 to the route.

Calculating the minimum route length

For a connected network, the length of the shortest closed route is the total weight of all the edges plus the least pairing cost. Four odd nodes give three pairings; six give fifteen, which is as far as a question will go, and a network with more than six odd nodes comes with a restriction that cuts the list down.

Counting the pairings is a question in its own right. Take the first odd node: it can be paired with any of the others, and whichever it takes, the rest have to be paired among themselves in the same way. So with 2n odd nodes there are 2n − 1 choices for the first, then 2n − 3 for the next unpaired node, and so on down to 1, giving the product of the odd numbers 1 × 3 × 5 × ... × (2n − 1). Four odd nodes give 3 × 1 = 3, six give 5 × 3 × 1 = 15, and eight give 7 × 5 × 3 × 1 = 105, which is why the cap sits where it does.

Fifteen is few enough to list in full. Setting them out in five groups of three, one group for each partner of the first node, keeps the list complete. The example below works those fifteen through in numbers.

All fifteen pairings of the six odd nodes, grouped by which node A takes: the cheapest costs 13 and makes the route 96 + 13 = 109
Describe the drawing

A grid of fifteen boxes in five rows of three. Each row fixes the node A is paired with, from B at a cost of 4 down to F at 6, and the three boxes in the row are the three ways the remaining four odd nodes can then be paired off. The number at the right of each box is the whole cost of that pairing, A's own pair included. The first box of the first row is filled amber: A with B, C with D and E with F, at 4 plus 3 plus 6, comes to 13, and no other pairing of the fifteen comes near it. Added to the network's total weight of 96 it gives a shortest closed route of 109.

FIG. 2The fifteen pairings of six odd nodes in five groups of three, with the cheapest at 13 picked out.

WORKED EXAMPLE

Six odd nodes

A second network of total weight 96 has six odd nodes A to F, with shortest paths between them as tabulated. Find the shortest closed route using every edge at least once.

BCDEF
A479116
B5897
C368
D510
E6

Six odd nodes give 5 × 3 × 1 = 15 pairings, so work through them in an order that cannot lose one: pair A with each of the other five in turn, and pair the remaining four in their three ways each time.

A pairs withThe three ways of pairing the restTotals
B (4)CD + EF = 9, CE + DF = 16, CF + DE = 1313, 20, 17
C (7)BD + EF = 14, BE + DF = 19, BF + DE = 1221, 26, 19
D (9)BC + EF = 11, BE + CF = 17, BF + CE = 1320, 26, 22
E (11)BC + DF = 15, BD + CF = 16, BF + CD = 1026, 27, 21
F (6)BC + DE = 10, BD + CE = 14, BE + CD = 1216, 20, 18

The smallest of the fifteen totals is 13, from AB, CD and EF, at 4 + 3 + 6.

So the shortest closed route is 96 + 13 = 109, and the edges along the shortest A to B, C to D and E to F paths are the ones walked twice.

The next cheapest, AF with BC and DE at 16, pairs each node with a near neighbour and is still more expensive, because pairing A with F leaves C and D unable to use the cheap path between them.

Two variations come up. With no odd nodes, nothing is repeated and the answer is simply the total weight. If the route need not return to the start, leave two odd nodes unpaired to be the ends of the route, pair the rest as cheaply as possible, and start and finish at the two left over. With four odd nodes that means repeating one pair only, so choose the pair whose shortest path is least and leave the other two as the ends. The two left out need not be the pair with the longest shortest path between them: with AB 5, AD 9, AE 13, BD 7, BE 9 and DE 9, repeating AB at 5 is cheapest and leaves D and E as the ends, although AE at 13 is the longest of the six.

The network with the edge from A to B and the path from D through C to E drawn heavily in coral. Those are the stretches walked twice, and adding their length to the total of all the edges gives sixty-nine.
FIG. 3The chosen repeats drawn on the network: AB, and the path from D through C to E.

GUIDED PRACTICE

The full answer

The nine edges of the network total 55. Find the length of the shortest closed route travelling along every edge at least once, and say which edges are repeated.

Show the working

The cheapest pairing costs 14.

Total = 55 + 14 = 69.

The repeated edges are AB, and the shortest D to E path, which is D to C to E.

So DC and CE are each walked twice, as is AB, and every other edge exactly once.

Limitations of the route-inspection model

The network is a model, and the 69 inherits whatever went into it. Four assumptions were made before any arithmetic started: each street became one edge, walking it either way cost the same, junctions became nodes, and the round had to finish where it began. A question asking you to evaluate the model is asking which of those four the situation supports, and the answer is usually that three do and one does not.

Modifying one of them is arithmetic rather than a new method, though it rarely stops at a single number. Close a road and two things move together: the total weight falls by that edge's weight, and the orders of its two ends each drop by one, so the list of odd nodes changes and the pairings have to be worked out again from scratch. Revise a weight and the total moves, and a shortest path between two odd nodes may reroute, which can hand the cheapest pairing to a different pair.

Refining means changing the graph itself. One-way streets need a digraph, and pairing odd nodes has nothing to say there, since what has to be matched is nodes with more arcs in than out against nodes with more out than in. A gritting lorry that treats a dual carriageway as two roads wants two edges where the map draws one. A round that may finish anywhere drops the closing condition, which is the variation above.

Then judge the answer rather than reporting it. The output is not the number 69 but the sentence it stands for: the shortest round covers every street and walks AB, DC and CE a second time, at a cost of 69 in whatever unit the weights carry. Put that way it can be tested against the situation by a reader who knows the streets, which a bare 69 cannot be.

WORKED EXAMPLE

Closing a road

The road CD, of weight 3, is closed for resurfacing. Rework the answer and say what has changed.

Eight roads are left, totalling 55 − 3 = 52, and the orders of C and D each fall by one, so C becomes 3 and D becomes 2.

The odd nodes are now A, B, C and E rather than A, B, D and E, which is the part a careless answer misses.

Shortest paths between them: AB 5, AC 7, AE 13, BC 4, BE 9, CE 6. The three pairings cost AB + CE = 11, AC + BE = 16 and AE + BC = 17.

So the round is 52 + 11 = 63, with AB and CE repeated.

The number fell, and the reason has to be stated with it: the network has changed, with 3 less road to cover and a pairing 3 cheaper. Setting 63 beside 69 without saying so compares the answers to two different questions.

ASSESSMENT FOCUS

  • List the odd nodes first. If there are none, the answer is the total weight and nothing is repeated.
  • Write out every pairing with its cost, even the ones you can see are worse: three of them for four odd nodes, fifteen for six.
  • With six odd nodes, pair the first one with each of the other five in turn and split the remaining four three ways, so that none of the fifteen goes missing.
  • Use shortest paths between odd nodes, which may pass through other nodes.
  • State the repeated edges as well as the total. The question almost always asks.
  • When an arc is removed or a weight revised, recheck the odd nodes before touching the pairings. Both ends change parity.
  • Asked to comment on the model, name one assumption and say what the answer would do without it.

CHECK YOURSELF

A network of total weight 80 has odd nodes P, Q, R, S with shortest paths PQ 6, PR 9, PS 11, QR 8, QS 5, RS 7. Find the shortest closed route.

Show a hint

Three pairings; take the cheapest.

Show the answer

PQ + RS = 13, PR + QS = 14, PS + QR = 19. Cheapest is 13, so the route is 80 + 13 = 93.

In a connected network, odd nodes force repetition, so pair them up and repeat a shortest path between each pair.

2n odd nodes have 1 × 3 × 5 × ... × (2n − 1) pairings, so four give three and six give fifteen.

The answer is the total weight of the network plus the cost of the cheapest pairing, and the repeated edges must be named.

Closing an arc changes the parity of both its ends, so a modified network needs its odd nodes and its pairings found again.

WORKBOOK

Printable practice for this topic: original exam-style questions with room to work, and a fully worked answer book. Free to use; please do not redistribute or sell.

15 questions on this topicAnswer them one at a time and mark yourself against the worked answer.Practise this topic

Or read them with their worked answers on the route inspection questions page.

CHECK YOUR PROGRESS

Rate how confident you feel with each objective for this lesson. Ratings are saved in this browser, on this device, unless you sign in.

  • Identify the odd nodes and list every possible pairing of them.
  • Count the pairings of 2n odd nodes as the product of the odd numbers up to 2n − 1.
  • Find the shortest path between each pair and choose the cheapest pairing.
  • State the length of the shortest closed route and which edges are repeated.
  • Adapt the method when the route need not return to the start.
  • Say what a network model assumed, and rework the answer when a road closes or a weight is revised.

Open the full revision checklist to see every objective in the course in one place.