Implement the Floyd-Warshall algorithm to solve the all-pairs shortest path problem. Update the input adjacency matrix with shortest path distances.
{
"matrix": [
[
0,
25
],
[
-1,
0
]
]
}[
[
0,
25
],
[
-1,
0
]
]{
"matrix": [
[
0,
1,
43
],
[
1,
0,
6
],
[
-1,
-1,
0
]
]
}[
[
0,
1,
7
],
[
1,
0,
6
],
[
-1,
-1,
0
]
]{
"matrix": [
[
0,
2,
-1,
-1
],
[
1,
0,
3,
-1
],
[
-1,
-1,
0,
-1
],
[
3,
5,
4,
0
]
]
}[
[
0,
2,
5,
-1
],
[
1,
0,
3,
-1
],
[
-1,
-1,
0,
-1
],
[
3,
5,
4,
0
]
]Sign in to Run Code and Submit