Breadth-First Search (BFS)
function BFS(graph, start, end):
queue = [start]
visited = {start}
while queue is not empty:
current = queue.dequeue()
if current == end:
return path
for each neighbor of current:
if neighbor not in visited:
visited.add(neighbor)
queue.enqueue(neighbor)
return no path exists