Skip to content

Commit 9f3e81c

Browse files
committed
Use collections.deque as queue in the correct syntax: queue = deque([start])
1 parent f00598c commit 9f3e81c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

graphs/breadth_first_search_shortest_path_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def bfs_shortest_path_distance(graph: dict, start, target) -> int:
9090
return -1
9191
if start == target:
9292
return 0
93-
queue = deque(start)
93+
queue = deque([start])
9494
visited = set(start)
9595
# Keep tab on distances from `start` node.
9696
dist = {start: 0, target: -1}

0 commit comments

Comments
 (0)