Skip to content

Bellman-Ford shortest paths

networks

Level 3 of 3

Also called Bellman-Ford algorithm and Single-source shortest paths with negative lengths.

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 bellman-ford shortest paths's own run on the numbers shown.

choose one

question 1

On this line from A, how many roads does the run look along?

696A0BCD
the answer, and why

the answer is A

Round 1 looks along all 3 roads and round 2 along all 3 again, finding nothing shorter.

if you chose another

  • That is round 1 alone. A round must make nothing shorter before the run stops.
  • That is the same line backwards.
  • That is n×mn \times m, the ceiling on any map of 4 places and 3 roads.

new numbersthe test page's numbers

question 2

On which map does the run look along the most roads? D>G 1 means a road from D to G, 1 long, and the letter after the semicolon is the start.

the answer, and why

the answer is B

The run looks along 11 roads on F>G -2, G>H -3, G>B 5, B>A 1; F, the most of the four.

if you chose another

  • That map has 4 roads looked along, fewer than 11.
  • That map has 10 roads looked along, fewer than 11.
  • That map has 4 roads looked along, fewer than 11.

new numbersthe test page's numbers