ReviseAlgo Logo
MediumVery High Frequency30 min

Graph BFS & Shortest Path

Find shortest paths in unweighted graphs using BFS with a visited set.

Graph BFS finds shortest paths (unweighted). Queue + visited set. Each BFS level = one hop from source. Use for word ladder, shortest path in grid, bipartite check.

Graph BFS — Shortest Path (Unweighted)

Shortest Path by Levels

BFS Frontier Expansion1 / 9
Start node
ABCDEFG

Start BFS at A

Initialize the queue with A. BFS expands level by level from this source.