Skip to content

Commit f18b189

Browse files
authored
Update design-graph-with-shortest-path-calculator.py
1 parent 2b6f569 commit f18b189

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Python/design-graph-with-shortest-path-calculator.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def shortestPath(self, node1, node2):
3232
:type node2: int
3333
:rtype: int
3434
"""
35-
def dijkstra(start, target):
35+
def dijkstra(adj, start, target):
3636
best = [float("inf")]*len(adj)
3737
best[start] = 0
3838
min_heap = [(best[start], start)]
@@ -47,5 +47,4 @@ def dijkstra(start, target):
4747
heapq.heappush(min_heap, (best[v], v))
4848
return best[target] if best[target] != float("inf") else -1
4949

50-
adj = self.__adj
51-
return dijkstra(node1, node2)
50+
return dijkstra(self.__adj, node1, node2)

0 commit comments

Comments
 (0)