Floyd's algorithmEdexcel A-Level Further Maths: Subtopic test
10 questions, 27 marks
Edexcel A-Level Further Maths
Floyd's algorithm
Total 27 marks
Name
Class
Date
- 1A network has four vertices , , and . The roads and their lengths are , , , and . Floyd's algorithm is applied, with the pivots in the order , , , . In the distance table the leading diagonal is 0 and a dash means there is no direct road. In the route table, the entry in row , column is the first vertex to travel to when going from to ; initially it is itself. Each iteration uses the next vertex in order as the pivot (iteration 1 uses the first row and column).(a)After iteration 1 (pivot ), what is the entry in row , column of the distance table?[1 mark]
- A
- B
- C
- D
(b)After iteration 1, what is the entry in row , column of the route table?[1 mark]- A
- B
- C
- D
(c)Complete the algorithm. Find the shortest distance from to and use the final route table to give the route.[2 marks]Total for question 1: 4 marks
- 2Five sites to are joined by roads with lengths in km: , , , , and . Floyd's algorithm is applied, with the pivots in the order , , , , . In the route table, the entry in row , column is the first vertex to travel to when going from to ; initially it is itself. Each iteration uses the next vertex in order as the pivot (iteration 1 uses the first row and column).(a)After iteration 2 (pivot ), what is the entry in row , column of the distance table?[1 mark]
- ANo entry (dash)
- B
- C
- D
(b)After iteration 3 (pivot ), what is the entry in row , column of the route table?[1 mark]- A
- B
- C
- D
(c)Complete the algorithm. Find the shortest distance from to and give the route.[2 marks]Total for question 2: 4 marks
- 3Four villages , , and are joined by roads with lengths in km: , , , and . Floyd's algorithm is applied, with the pivots in the order , , , . In the route table, the entry in row , column is the first vertex to travel to when going from to ; initially it is itself. Each iteration uses the next vertex in order as the pivot (iteration 1 uses the first row and column).(a)Carry out iterations 1 and 2. State each entry of the distance table that changes, with its new value, and the new route table entries.[3 marks](b)Complete the algorithm. Find the shortest distance and route from to , and show that the shortest route from to is not the direct road.[4 marks]
Total for question 3: 7 marks
- 4A one-way system links four junctions , , and . The one-way roads and their lengths in km are , , , , and . Floyd's algorithm is applied, with the pivots in the order , , , . A dash in the distance table means there is no route yet. In the route table, the entry in row , column is the first vertex to travel to when going from to ; initially it is itself. Each iteration uses the next vertex in order as the pivot (iteration 1 uses the first row and column).(a)Carry out all four iterations of Floyd's algorithm. For each iteration, state the entries that change, with their new distance and route entry.[6 marks](b)Use the final tables to find the shortest route from to and its length. Evaluate whether Floyd's algorithm is a better choice than Dijkstra's algorithm for a planner who needs the shortest distance between every pair of junctions.[6 marks]
Total for question 4: 12 marks
End of questions
Written by the Exaim team, led by Shaun Daswani (Head of Upper Secondary, Improve ME Institute; MSc Financial Mathematics, Imperial College London; BSc, UCL) and Jason Daswani (operational lead, Improve ME Institute; LSE).