We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ec1912 commit 78cbb85Copy full SHA for 78cbb85
Algorithms/Graph Algorithms/Shortest Path Algorithm/Dijkstra's Algorithm/Python/dijkstra.py
@@ -41,6 +41,8 @@ def dijsktra(adj, vert):
41
distance = [0] * len(adj[vert])
42
processed = [False] * len(adj[vert])
43
44
+ # Initializes the distance array of initial vertex with values from the adjacency matrix
45
+ # if the edge is unexistent (-1), sets the distance as maxsize
46
for i in range(len(adj[vert])):
47
if adj[vert][i] == -1:
48
distance[i] = sys.maxsize
@@ -114,4 +116,4 @@ def test_directed():
114
116
printSolution(shortest)
115
117
118
test_undirect()
-test_directed()
119
+test_directed()
0 commit comments