AlgoScope

Floyd-Warshall

AlgorithmintermediateShortest Path

Admit one stopover vertex per round and relax every pair through it; the matrix converges in n rounds.

Decision · step 3 of 21All-Pairs Shortest Paths: Four vertices, three rounds of gains
0123012303∞780×2∞5∞012∞∞0

(1, 1): via 0 costs dist[1][0] + dist[0][1] = 8 + 3 = 11, against 0 so far. Not shorter, so the entry stays. Every other pair this round is the same check.

Open in the player →or start at step 3

What you will see

The distance matrix updates for each k; cell (i, j) reads (i, k) and (k, j) with dependency arrows.

How all-pairs shortest paths works →

Cost

BestO(V^3)
AverageO(V^3)
WorstO(V^3)
SpaceO(V^2)

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.