Home▸Networks & Graph Theory▸Floyd-Warshall All-Pairs Shortest Paths (2D)

Floyd-Warshall All-Pairs Shortest Paths (2D)

2D Floyd-Warshall lab: the real O(n³) triple-nested-loop dynamic-programming relaxation running step by step over a weighted graph, with a live distance-matrix heatmap and click-to-query shortest-path reconstruction via the next-hop matrix.

Networks & Graph Theory2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-floyd-warshall ↗ Open standalone

This 2D companion runs the unmodified Floyd-Warshall dynamic-programming recurrence — the real O(n³) triple loop over pivot k, source i and target j — against a small weighted directed graph, advancing one relaxation test at a time so each dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]) comparison is visible as it happens. A live distance-matrix heatmap shows exactly which cell improves at each step, and clicking any two nodes reconstructs their actual shortest path by walking the next-hop matrix built alongside the distances, turning the algorithm's textbook pseudocode into something you watch run.

⚙ Under the hood

2D Floyd-Warshall lab: the real O(n³) triple-nested-loop dynamic-programming relaxation running step by step over a weighted graph, with a live distance-matrix heatmap and click-to-query shortest-path reconstruction via the next-hop matrix.

floyd-warshallshortest pathdynamic programminggraph theorydistance matrix

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)