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.

Finds the shortest way from one place to every other on one-way roads, even roads that pay you back, with a length below 0. Look along every road, round after round, until a whole round makes nothing shorter; if a loop of roads keeps getting shorter for ever, it says so.

roads looked along
0
rounds
0

step 1 of 1

Examples

Tap a spot to put your pen down there, then tap a spot next to it to draw a road. Keep tapping to draw on.

Places stand in two rows, A to D above and E to H below. A one-way road joins two places next to each other (one road across each square), with a > and a length from -9 to 99: A>B 4, F>B -2. Then a semicolon and where to start: A>B 4, B>F 2; A.