Skip to content

DSA Visualizer

Graph search, step by step

Same graph, same starting node, two different traversal orders. The only difference between BFS and DFS is whether nodes waiting to be visited sit in a queue or a stack.

Both start from A on the same fixed graph — compare the visit order. BFS explores level by level (queue); DFS commits to one path before backtracking (stack).

ABCDEFG
Step 1 of 15

Breadth-first search from A. A queue holds nodes waiting to be visited — BFS explores level by level, all neighbors before any of their neighbors.