Why it matters
Floyd-Warshall is simple and general. Great for small dense graphs.
Advertisement
The architecture
dp[i][j] using k as intermediate.
Iterate k, i, j.
O(V^3) time.
Advertisement
How it works end to end
DP over intermediate vertices.
O(V^3) time.
Handles negative weights.