7.04e, 7.04f - Route inspection and choosing algorithms

7.04e, 7.04f - Route inspection and choosing algorithms

Plan a shortest inspection journey that covers every road, including necessary repetitions. You will pair odd vertices, compare all pairings of up to six odd vertices, count those pairings, adapt the endpoints, and choose an algorithm from the practical objective.

Closing an inspection route

An inspector must cover every road and return to the depot. Is it enough to repeat the road joining the two nearest odd junctions? With four or six odd junctions, that locally cheap choice can leave an expensive problem behind. The whole pairing matters.

You already know

A connected undirected graph has an Eulerian circuit exactly when every vertex has even degree. With exactly two odd vertices, it has an Eulerian trail starting at one and finishing at the other. Traversing an edge again can be modelled by adding a parallel copy.

The road-inspection model here is a connected undirected network with non-negative weights. Every edge must be traversed at least once; vertices and edges may be revisited. If every degree is even, an Eulerian circuit uses every edge exactly once, so the original total weight is already the minimum closed inspection weight.

Repeating a path changes the parity of its endpoints. Every internal vertex gains two incidences and keeps its parity. Consequently, pairing the odd vertices and duplicating the paths between each pair makes every degree even.

Closed route inspection

Let WW be the sum of all original edge weights. Find shortest-path distances between the odd vertices, and choose a complete pairing of those vertices with minimum total distance PP. Then

minimum closed inspection weight=W+P\text{minimum closed inspection weight}=W+P

If there are no odd vertices, P=0P=0. Each original edge contributes to WW once, however many times the final route uses it.
In the formula booklet.

Shortest connecting paths are essential: a direct edge may cost more than an indirect journey, and a pair need not be directly connected. Dijkstra supplies the distances if they are not obvious.

Why does the least pairing give an optimum, rather than just one possible route? In any closed inspection, the extra traversals must correct the original odd degrees. Those extra edges can be separated into paths pairing the odd vertices, together with possible closed circuits. Non-negative circuits cannot reduce the cost, and each connecting path costs at least its shortest-path distance. Thus no closed inspection can beat the least pairing total; duplicating the selected shortest paths attains it.

Worked example 1: two odd vertices

Question. Roads form triangle ABCABC, with AB=3AB=3, BC=4BC=4, CA=5CA=5, and a tail C−D−EC-D-E, with CD=2CD=2, DE=3DE=3. Find the minimum inspection weight, starting and finishing at AA.

Plan. Find odd vertices, duplicate a shortest path between them, then add its weight to the original total.

W=3+4+5+2+3=17count each original edge oncedeg⁡(C)=3,deg⁡(E)=1only odd verticesd(C,E)=2+3=5shortest path C−D−EW+P=17+5=22make both odd degrees even\begin{aligned} W&=3+4+5+2+3=17 &&\text{count each original edge once}\\ \deg(C)=3,\quad\deg(E)&=1 &&\text{only odd vertices}\\ d(C,E)&=2+3=5 &&\text{shortest path }C-D-E\\ W+P&=17+5=22 &&\text{make both odd degrees even} \end{aligned}

Why this step? Starting at AA does not make AA an odd vertex; a closed route must have even degree everywhere.

Answer. Minimum weight 2222, duplicating CDCD and DEDE.

Check. The route A−B−C−D−E−D−C−AA-B-C-D-E-D-C-A uses every road and has weight 3+4+2+3+3+2+5=223+4+2+3+3+2+5=22.

Change only the length of DEDE. It appears once in the original total and once in the duplicated path.

Worked example 2: a longer bridge

Question. In example 1, DEDE has weight 66 instead of 33. Find the new minimum closed inspection weight.

Plan. Recalculate both the original total and the shortest path between the unchanged odd vertices.

W=3+4+5+2+6=20new original totalP=d(C,E)=2+6=8only odd pairingW+P=20+8=28closed inspection minimum\begin{aligned} W&=3+4+5+2+6=20 &&\text{new original total}\\ P=d(C,E)&=2+6=8 &&\text{only odd pairing}\\ W+P&=20+8=28 &&\text{closed inspection minimum} \end{aligned}

Why this step? The tail is a dead end, so each of its roads must be used in both directions on a closed inspection journey.

Answer. 2828.

Check. Increasing the tail edge by 33 increases the closed journey by 66, because that edge is traversed twice.

With two odd vertices there is only one pairing, but you must still use a shortest path between them.

Four odd vertices

Four odd vertices have three complete pairings. Compare all three sums before choosing what to repeat.

[DIAGRAM: asset_name: Four odd junctions; asset_slug: h245_7_04_four_odd; caption: Every vertex has odd degree; repeating AB and CD gives the least additional weight 6; description: Complete undirected network A B C D with AB 3 AC 4 AD 8 BC 2 BD 5 CD 3. Highlight the repeated pairing AB and CD as parallel dashed arcs. Show pairing totals AB plus CD equals 6, AC plus BD equals 9, AD plus BC equals 9, where shortest AD distance is 7 through C.]
Every vertex has odd degree

For odd vertices A,B,C,DA,B,C,D, once AA's partner is chosen, the other pair is forced. The possibilities are (AB,CD)(AB,CD), (AC,BD)(AC,BD), (AD,BC)(AD,BC). Pair costs refer to shortest paths, not necessarily individual edges.

Worked example 3: comparing all pairings

Question. Find the minimum closed inspection weight for the pictured network.

Plan. Calculate its original weight, find the six pair distances, then compare the three pairing totals.

W=3+4+8+2+5+3=25sum original edgesW=3+4+8+2+5+3=25 \qquad\text{sum original edges}

Every vertex has degree 33. The shortest distances are

dAB=3, dAC=4, dAD=7, dBC=2, dBD=5, dCD=3d_{AB}=3,\ d_{AC}=4,\ d_{AD}=7,\ d_{BC}=2,\ d_{BD}=5,\ d_{CD}=3

Here dAD=4+3=7d_{AD}=4+3=7 through CC, shorter than the direct edge of weight 88.

PairingAdditional weight
AB,CDAB,CD3+3=63+3=6
AC,BDAC,BD4+5=94+5=9
AD,BCAD,BC7+2=97+2=9

Why this step? The individually cheapest pair BCBC leaves the expensive pair ADAD; its combined cost 99 loses to 66.

Answer. Duplicate ABAB and CDCD. Minimum weight 25+6=3125+6=31.

Check. Each vertex receives one extra incidence, changing its degree from 33 to 44; the connected augmented network is Eulerian.

Change only ADAD from 88 to 11. Recalculate shortest paths before comparing the same three pairings.

Worked example 4: an indirect distance changes

Question. Find the minimum closed inspection weight after this change.

Plan. Update the original total and all affected pair distances.

W=25−8+1=18changed original edgedAD=1new direct minimumdBD=3+1=4now shorter through A\begin{aligned} W&=25-8+1=18 &&\text{changed original edge}\\ d_{AD}&=1 &&\text{new direct minimum}\\ d_{BD}&=3+1=4 &&\text{now shorter through }A \end{aligned}

The other pair distances stay 3,4,2,33,4,2,3 for AB,AC,BC,CDAB,AC,BC,CD.

AB+CD=3+3=6first pairingAC+BD=4+4=8second pairingAD+BC=1+2=3third pairing, leastW+P=18+3=21add the least duplication\begin{aligned} AB+CD&=3+3=6 &&\text{first pairing}\\ AC+BD&=4+4=8 &&\text{second pairing}\\ AD+BC&=1+2=3 &&\text{third pairing, least}\\ W+P&=18+3=21 &&\text{add the least duplication} \end{aligned}

Why this step? Changing one road can improve another pair's shortest distance, such as B−DB-D, even though that pair's direct road did not change.

Answer. Duplicate ADAD and BCBC, giving minimum weight 2121.

Check. All four odd degrees become even and 1+21+2 is the least complete pairing sum.

The opening question now has a counterexample: in example 3, greedily taking BC=2BC=2 is worse than pairing ABAB and CDCD.

Watch out

Wrong: pair the closest two odd vertices, then accept whatever remains. Right: minimise the sum over a complete pairing of all odd vertices.

Find shortest pair distances before using the three-case comparison.

Six odd vertices

With six odd vertices, organise the fifteen pairings so that none is missed or counted twice.

[DIAGRAM: asset_name: Six odd junctions; asset_slug: h245_7_04_six_odd; caption: The nine original roads have total weight 36; all six junctions have degree 3; description: Hexagonal undirected network A B C D E F with cycle edges AB 2 BC 3 CD 4 DE 3 EF 2 FA 4 and chords AD 7 BE 6 CF 5. Highlight optimal duplicated edges AB CD EF, total 8. Place chord labels apart from crossings, and label crossings as having no junction.]
The nine original roads have total weight 36

Fix AA's partner in turn as B,C,D,E,FB,C,D,E,F. For each choice, the remaining four vertices have exactly the three pairings from part 2. That makes five groups of three, rather than an unstructured search.

Worked example 5: all fifteen cases

Question. Find the minimum closed inspection weight for the six-junction network in the diagram.

Plan. Use shortest-path distances, then compare the fifteen complete pairings grouped by AA's partner.

The original total is

W=2+3+4+3+2+4+7+6+5=36W=2+3+4+3+2+4+7+6+5=36

Every vertex has degree 33. The shortest distances are:

AABBCCDDEEFF
AA–2255776644
BB22–33776666
CC5533–447755
DD777744–3355
EE66667733–22
FF4466555522–

For example, d(A,E)=4+2=6d(A,E)=4+2=6 through FF, and d(B,F)=2+4=6d(B,F)=2+4=6 through AA.

PairingCostPairingCostPairingCost
AB,CD,EFAB,CD,EF88AB,CE,DFAB,CE,DF1414AB,CF,DEAB,CF,DE1010
AC,BD,EFAC,BD,EF1414AC,BE,DFAC,BE,DF1616AC,BF,DEAC,BF,DE1414
AD,BC,EFAD,BC,EF1212AD,BE,CFAD,BE,CF1818AD,BF,CEAD,BF,CE2020
AE,BC,DFAE,BC,DF1414AE,BD,CFAE,BD,CF1818AE,BF,CDAE,BF,CD1616
AF,BC,DEAF,BC,DE1010AF,BD,CEAF,BD,CE1818AF,BE,CDAF,BE,CD1414
P=2+4+2=8,W+P=36+8=44P=2+4+2=8,\qquad W+P=36+8=44

Why this step? Each row fixes AA's partner and exhausts the three possibilities left, so every complete pairing is considered exactly once.

Answer. Duplicate AB,CD,EFAB,CD,EF, giving minimum closed weight 4444.

Check. Each of the six vertices gains one incidence. The augmented connected network has all even degrees.

Change only CFCF from 55 to 11. Its effect is not limited to pairings explicitly containing CFCF: shortest distances such as CECE and BFBF also change.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account