All flashcards topics

Floyd's algorithmEdexcel A-Level Further Maths: Flashcards

What these 13 flashcards ask

  • What does Floyd's algorithm find?
  • What are the two tables in Floyd's algorithm?
  • What is in the distance table at the start?
  • What is in the route table at the start?
  • What does a route table entry (X,Y) mean?
  • How many iterations does a network with n vertices need?
  • Which row and column does iteration 1 use?
  • What is the update test in iteration K?
  • What is the new route entry when an update is made?
  • What if the new total equals the current value?
  • How do you read off a route?
  • Does the pivot's row or column change in its own iteration?
  • When is Floyd's algorithm better than Dijkstra's?

Exam questions on Floyd's algorithm

  1. A network has four vertices AA, BB, CC and DD. The roads and their lengths are AB=2AB=2, AC=3AC=3, BC=7BC=7, BD=10BD=10 and CD=4CD=4. Floyd's algorithm is applied, with the pivots in the order AA, BB, CC, DD. 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 XX, column YY is the first vertex to travel to when going from XX to YY; initially it is YY itself. Each iteration uses the next vertex in order as the pivot (iteration 1 uses the first row and column).
    Complete the algorithm. Find the shortest distance from BB to DD and use the final route table to give the route.2 marks
  2. Five sites AA to EE are joined by roads with lengths in km: AB=5AB=5, BC=3BC=3, CD=6CD=6, DE=2DE=2, EA=12EA=12 and BE=11BE=11. Floyd's algorithm is applied, with the pivots in the order AA, BB, CC, DD, EE. In the route table, the entry in row XX, column YY is the first vertex to travel to when going from XX to YY; initially it is YY itself. Each iteration uses the next vertex in order as the pivot (iteration 1 uses the first row and column).
    Complete the algorithm. Find the shortest distance from EE to CC and give the route.2 marks
  3. Four villages PP, QQ, RR and SS are joined by roads with lengths in km: PQ=3PQ=3, PR=5PR=5, QR=9QR=9, QS=7QS=7 and RS=2RS=2. Floyd's algorithm is applied, with the pivots in the order PP, QQ, RR, SS. In the route table, the entry in row XX, column YY is the first vertex to travel to when going from XX to YY; initially it is YY itself. Each iteration uses the next vertex in order as the pivot (iteration 1 uses the first row and column).
    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
See the full worksheet

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).