← All-pairs distances (landing page)

All-Pairs Distances by Admitting Intermediates

Floyd–Warshall as layer-by-layer min-plus relaxation

The same relaxation that fills a single distance label can fill the whole distance matrix — one allowed intermediate node at a time, until the matrix is the tropical closure W*.

Admit one intermediate node, then relax every pair through it. After admitting all of them, every entry is an all-pairs shortest distance.

Graph
Mode
Playback
Speed

Distance matrix D

Graph

Current step

Event log

    Legend
    Pivot row & column — the admitted intermediate k
    The two addends D[i][k] and D[k][j]
    Cell under test D[i][j]
    Improved this step
    Negative diagonal — a negative cycle
    Graph: the admitted intermediate node