Floyd-Warshall order matters
transcript
Floyd-Warshall has three loops. The order matters. Which loop is outer?
Take a chain: zero, one, three, two. With the middle node inner, the pair zero and two never finishes. The total is a billion and seven. With it outer, the total is ten.
Each outer round allows one more stop. It applies to every pair at once. So later rounds build on earlier ones.
The outer loop picks the middle node. The two inner loops pick both ends. Repeat for each possible stop.
A hundred services. The three loops make a million steps. That is fast.
Test a chain of four services. Scramble the labels so order differs. Check that every pair finishes.
Write a slow twin that runs a search from each node. It has no loop order to get wrong. Compare both on small random graphs.
Then both ends inside. Test a scrambled chain. Full breakdown in the lecture.