A2 June 2025 Q3
3.

Direct roads between seven villages, A, B, C, D, E, F and G, are represented in Figure 1. The weight on each arc is the time, in minutes, taken to travel along the corresponding road. Three roads, AB, AD and GE, are one-way, as indicated by the arrow on the corresponding arc.
Floyd’s algorithm is to be used to find the complete network of shortest times between the seven villages.
The time matrix after three iterations of Floyd’s algorithm is shown below.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| A | – | 9 | 49 | 17 | 35 | 44 | 11 |
| B | ∞ | – | 40 | 8 | ∞ | 35 | 87 |
| C | ∞ | 40 | – | 17 | ∞ | 75 | 47 |
| D | ∞ | 8 | 17 | – | 11 | 31 | 64 |
| E | 35 | 44 | 84 | 11 | – | 14 | 46 |
| F | ∞ | 35 | 75 | 31 | 14 | – | 12 |
| G | 11 | 20 | 47 | 28 | 24 | 12 | – |
You should show only the time matrix after each iteration. (5)
The final time matrix after completion of Floyd’s algorithm is shown below.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| A | – | 9 | 34 | 17 | 28 | 23 | 11 |
| B | 54 | – | 25 | 8 | 19 | 33 | 45 |
| C | 58 | 25 | – | 17 | 28 | 42 | 47 |
| D | 46 | 8 | 17 | – | 11 | 25 | 37 |
| E | 35 | 19 | 28 | 11 | – | 14 | 26 |
| F | 23 | 32 | 42 | 25 | 14 | – | 12 |
| G | 11 | 20 | 45 | 28 | 24 | 12 | – |
Albert must visit each village. He will start and finish at B and wishes to minimise the total time taken to visit each village.
| Scheme | Marks | AO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| B2, 1, 0 | 1.1b 1.1b | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (2) |
Notes
a1B1: At least three rows and three columns correct (condone at most 2 empty cells but accept consistent blanks for the leading diagonal)
a2B1: CAO
| Scheme | Marks | AO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Fourth iteration:
| M1 A1 | 2.1 1.1b | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Fifth iteration:
| M1 A1 A1 | 2.1 1.1b 2.2a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (5) |
Notes
b1M1: No change in the fourth row and fourth column with at least two values reduced correctly (condone at most 2 empty cells but accept consistent blanks for the leading diagonal)
b1A1: CAO for the fourth iteration (changes in bold and blue shading)
b2M1: No change in the fifth row and fifth column with at least two values reduced correctly (follow through from their previous iteration) (condone at most 2 empty cells but accept consistent blanks for the leading diagonal)
b2A1: At least eight values reduced correctly (from the values shown in bold and orange shading)
b3A1: CSO for the fourth and fifth iterations
(if correct changes for the fifth iteration are shown in bold and orange shading)
| Scheme | Marks | AO |
|---|---|---|
| (i) NNA starting at B: B – D – E – F – G – A – C – B | B1 | 2.2a |
| (ii) Time taken: 8 + 11 + 14 + 12 + 11 + 34 + 25 = 115 (minutes) | B1 | 1.1b |
| (iii) Actual villages visited: BDEFGA\(\underline{\text{BD}}\)C\(\underline{\text{D}}\)B | B1 | 2.2a |
| (3) | ||
| (10 marks) |
Notes
ci1B1: CAO (Nearest neighbour cycle starting at B – must include return to B) (condone the use of arcs BD DE EF FG GA AC CB – must be written in this manner and not AG or BC)
cii2B1: Correct time
ciii3B1: Correct route – must be stated as nodes


























