dedicated visualizer
Breadth-First Search
Explores graph layers in queue order and finds shortest paths in unweighted graphs. This page keeps the runner, chart, and controls focused on a single algorithm so the walkthrough feels calmer than the overview page.
session controls
Compare this algorithm against a related one, turn on quiz mode, or keep the current state in a shareable URL.
current shareable URL
Copy the URL to preserve this exact dataset, target, compare mode, and quiz state.
browse more
Want a different problem or visual mode? Jump back to the catalog and open another dedicated page.
open catalogscenario presets
Load a focused input that reveals a specific behavior quickly instead of hand-editing every value first.
graph controls
Graph algorithms reuse the same learning graph so you can compare traversal and shortest-path behavior side by side.
graph note
BFS and DFS emphasize traversal order. Dijkstra adds weighted relaxations and a cost-aware final route.
chart + counters
The visualization and the live counters stay together so each step is easier to read.
current action · enqueue start
current action
enqueue start
visited
1
final 7
queue
1
final 0
frontier
1
final 0
steps
1 / 15
queue
A
current node
none
run summary
Finished in 15 steps. G is the target node, so BFS stops here.
visited
7
queue
0
frontier
0
steps
15
final route
A → C → F → G
current explanation
Breadth-first search starts by enqueueing A.
simple explanation
BFS explores level by level using a queue.
pseudocode
complexity card
best
O(V + E)
average
O(V + E)
worst
O(V + E)
space
O(V)
algorithm notes
intuition
BFS moves outward in waves, so the first time it reaches a node is the shortest unweighted route.
tradeoffs
- Excellent for shortest paths in unweighted graphs.
- Queue can grow large on wide graphs.
- Visits neighbors in strict breadth order.
when to use it
Use for reachability, level-order traversal, and shortest paths when every edge has equal cost.
interview tips
- Mention parent tracking if you need to reconstruct the path.
- Explain why the first visit to a node is enough in an unweighted graph.
what I learned building this
typed definitions
One algorithm schema now drives the catalog, counters, pseudocode, notes, and visual modes, which keeps the UI consistent as the lab grows.
replay over mutation
Precomputed steps made it much easier to synchronize explanations, metrics, quiz prompts, and scrubber playback without hidden state drifting out of sync.
portfolio framing
Shareable URL state, compare mode, and responsive layouts mattered as much as the algorithm logic because this page needs to teach clearly and still feel polished as a product.
more in this lane
Want a different take on the same problem family? These stay in the same category but change the strategy.