diff --git a/graphs/breadth_first_search_shortest_path_2.py b/graphs/breadth_first_search_shortest_path_2.py index efba9b7b6ae6..973256bae1e7 100644 --- a/graphs/breadth_first_search_shortest_path_2.py +++ b/graphs/breadth_first_search_shortest_path_2.py @@ -91,7 +91,7 @@ def bfs_shortest_path_distance(graph: dict, start, target) -> int: if start == target: return 0 queue = deque([start]) - visited = set(start) + visited = {start} # Keep tab on distances from `start` node. dist = {start: 0, target: -1} while queue: