Concept Flow - Floyd Warshall All Pairs Shortest Path
Start with distance matrix
Pick intermediate node k
For each pair (i, j)
Check if path i->k + k->j < i->j
Yes/No
Update distance[i
Repeat for all i, j
Repeat for all k
Final shortest paths matrix
The algorithm updates shortest paths by checking if going through an intermediate node k improves the path between every pair (i, j).