BFS explores a graph level by level, visiting all neighbors of a node before moving deeper. It uses a queue and finds the shortest path (fewest edges) in unweighted graphs.
The idea
Start at a source, enqueue it, then repeatedly dequeue a node, visit its unvisited neighbors, and enqueue them. A visited set prevents revisiting.
