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).
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.
Put this into practice
Connect the idea to a worked lesson, a practical task or your interview preparation.
- Concept guideTrees and Graphs →Structures for data that branches or connects in more than one direction, from file systems to route maps.
- Practice problemShortest Hop Count →Solve this hard problem with samples, hints and checks in your browser.
- Practice problemBinary Tree Level Order Sum →Solve this easy problem with samples, hints and checks in your browser.
- Interview prepCoding & DSA interview questions →The concepts behind data-structure and algorithm interview questions — paired with the practice problems that let you actually write the code.
Last updated: