Mistake : Looping , , instead of , , . This breaks the DP dependency and gives wrong answers. Mistake : Forgetting dist[i][i] = 0. This makes the algorithm think the distance from to itself is infinity.
Mistake : Not checking for negative cycles before using values. If dist[i][i] < 0, the entire distance matrix is invalid. These are the most common errors when implementing Floyd-Warshall.