Python, Programming, Algorithms, Interview.
D[i][k] represents the shortest path that only uses the first K vertices. and D[k][j] represents the shortest path between the pair(k, j). def FloydWarshall(N, edges): g = [[math.inf for _ in range(N)] for _ in range(N)] for u, v, w in edges: g[u][v] = w g[v][u] = w for u in range(N): g[u][u] = 0