AlgoScope

Bellman-Ford

AlgorithmintermediateShortest Path

Relax every edge V-1 times; a further improvement means a negative cycle.

Decision · step 2 of 9Shortest Paths: Bellman-Ford from 0
4121530✓014234

Pass 1, edge 0 to 1: 0 + 4 = 4 against infinity. Shorter, so 1 becomes 4.

Open in the player →or start at step 2

What you will see

Whole-graph relaxation passes; distances settle pass by pass; a V-th pass that changes anything flags a negative cycle.

How shortest paths works →

Cost

BestO(E)
AverageO(V * E)
WorstO(V * E)
SpaceO(V)

Best case with early exit when a pass changes nothing.

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next, try operations in any order.

Screen readers: Vertices announce name, tentative distance and parent; each step announces the relaxation and whether it improved a distance.

Reduced motion: Distance updates change the label with a crossfade instead of radiating from the edge.

Before this

Leads to

Topics that need this one first.

Taught by the same lesson

Shortest Paths covers these too, in the same run.