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?

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

the answer, and why

the answer is B

The run looks along 10 roads on F>G -2, G>B -4, C>D 1, B>C 7; F, the most of the four.

if you chose another

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

new numbersthe test page's numbers