Skip to content

Floyd-Warshall, every pair

networks

Level 3 of 3

Also called Floyd-Warshall algorithm and All-pairs shortest paths.

fresh numbers

The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from floyd-warshall, every pair's own run on the numbers shown.

choose one

question 1

How many pairs does the run try on this line of 5 places?

1424AEFGHAEFGHAEFGH040204010
the answer, and why

the answer is A

5 stops, 4 places to start from and 3 to end at each, so 5 times 4 times 3, which is 60.

if you chose another

  • That is a map of 4 places.
  • That is 5 times 5 times 5, the ceiling, which also counts the choices that share a place.
  • That is the ways made shorter, not the pairs tried.

new numbersthe test page's numbers

question 2

On which map does the run make the most ways shorter? C>G 3 means a road from C to G, 3 long.

the answer, and why

the answer is C

The run makes 4 ways shorter on A>B 3, B>C 2, G>H 7, G>B 8, B>E 6, the most of the four.

if you chose another

  • That map has 2 ways made shorter, fewer than 4.
  • That map has 1 way made shorter, fewer than 4.
  • That map has no way made shorter, fewer than 4.

new numbersthe test page's numbers