from collections import defaultdict, deque def bfs(graph, start, end): queue = deque([(start, 0)]) visited = {start: 0} while queue: node, dist = queue.popleft() if node == end: return dist for neighbor in graph[node]: if neighbor not i...