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 B, how many roads does the run look along?

359B0CGH
the answer, and why

the answer is D

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? G>B 8 means a road from G to B, 8 long, and the letter after the semicolon is the start.

the answer, and why

the answer is C

The run looks along 14 roads on B>G 8, G>H 7, G>F 4, A>E 7, B>A 1; B, the most of the four.

if you chose another

  • That map has 5 roads looked along, fewer than 14.
  • That map has 2 roads looked along, fewer than 14.
  • That map has 2 roads looked along, fewer than 14.

new numbersthe test page's numbers