Given a weighted graph with non-negative weights and a source vertex, return the shortest distance from the source to all vertices.
{
"V": 3,
"adj": [
[
[
1,
1
],
[
2,
6
]
],
[
[
0,
1
],
[
2,
3
]
],
[
[
0,
6
],
[
1,
3
]
]
],
"S": 2
}[
4,
3,
0
]{
"V": 5,
"adj": [
[
[
1,
2
],
[
2,
4
]
],
[
[
0,
2
],
[
2,
1
],
[
3,
7
]
],
[
[
0,
4
],
[
1,
1
],
[
4,
3
]
],
[
[
1,
7
],
[
4,
1
]
],
[
[
2,
3
],
[
3,
1
]
]
],
"S": 0
}[
0,
2,
3,
7,
6
]{
"V": 4,
"adj": [
[
[
1,
5
]
],
[
[
0,
5
],
[
2,
2
]
],
[
[
1,
2
]
],
[]
],
"S": 0
}[
0,
5,
7,
1000000000
]Sign in to Run Code and Submit