A2 June 2022 Q3
3. The initial distance matrix (Table 1) shows the lengths, in metres, of the corridors connecting six classrooms, A, B, C, D, E and F, in a school. For safety reasons, some of the corridors are one-way only.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| A | – | 12 | 32 | 24 | 29 | 11 |
| B | 12 | – | 17 | 8 | ∞ | ∞ |
| C | 32 | 17 | – | 4 | 12 | ∞ |
| D | 24 | ∞ | 4 | – | ∞ | 13 |
| E | ∞ | ∞ | 12 | 18 | – | 12 |
| F | 11 | ∞ | ∞ | 13 | 12 | – |
Table 1

Floyd’s algorithm is to be used to find the complete network of shortest distances between the six classrooms.
The distance matrix after two iterations of Floyd’s algorithm is shown in Table 2.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| A | – | 12 | 29 | 20 | 29 | 11 |
| B | 12 | – | 17 | 8 | 41 | 23 |
| C | 29 | 17 | – | 4 | 12 | 40 |
| D | 24 | 36 | 4 | – | 53 | 13 |
| E | ∞ | ∞ | 12 | 18 | – | 12 |
| F | 11 | 23 | 40 | 13 | 12 | – |
Table 2
The final distance matrix after completion of Floyd’s algorithm is shown in Table 3.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| A | – | 12 | 24 | 20 | 23 | 11 |
| B | 12 | – | 12 | 8 | 24 | 21 |
| C | 28 | 17 | – | 4 | 12 | 17 |
| D | 24 | 21 | 4 | – | 16 | 13 |
| E | 23 | 29 | 12 | 16 | – | 12 |
| F | 11 | 23 | 17 | 13 | 12 | – |
Table 3
Yinka must visit each classroom. He will start and finish at E and wishes to minimise the total distance travelled.
| Scheme | Marks | AO |
|---|---|---|
![]() | M1 A1 | 1.1b 1.1b |
| (2) |
Notes
(a) M1: Correct five arcs from A
A1: cao no additional arcs or arrows, correct weights and arc AE directed from A to E
| Scheme | Marks | AO | |||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Third iteration:
| M1 A1 | 1.1b 1.1b | |||||||||||||||||||||||||||||||||||||||||||||||||
Fourth iteration:
| M1 A1 | 1.1b 1.1b | |||||||||||||||||||||||||||||||||||||||||||||||||
| (4) |
Notes
In the distance matrix for part (b) ignore whatever is written in the lead diagonal (top left to bottom right) and just consider the values (ignore shading etc.) – check bottom of page 9 for replaced matrices
(b) M1: No change in the third row and third column with at least two values reduced correctly (no blank entries – apart from the lead diagonal)
A1: cao for the third iteration
M1: No change in their fourth row and fourth column (following their third iteration) with at least two values correctly reduced follow through from their previous iteration (no blank entries – apart from the lead diagonal)
A1: cso for both iterations (no follow through from an incorrect third iteration even if the fourth iteration is ‘correct’ so M1A0M1A1 is not possible in this part)
| Scheme | Marks | AO | ||||
|---|---|---|---|---|---|---|
Nearest neighbour routes:
| M1 A1 A1 A1 | 3.4 1.1b 1.1b 2.4 | ||||
| (4) | ||||||
| (10 marks) |
Notes
(c) M1: Either cycle correct (must include returning to E) – nodes must be in the correct order and therefore not reversed but allow if stated in terms of arcs. If only one cycle correct then M1 only
A1: Both cycles correct – nodes must be in the correct order but allow if stated in terms of arcs
A1: Both cycles and corresponding lengths correct
A1: Correct reasoning that the smallest (oe) value is the better upper bound – dependent on all previous marks in this part (cso)
