BFS vs DFS Traversal Animator
How to Use
- Click "Start" to begin both traversals simultaneously
- Click "Step" to advance both traversals one step at a time
- Watch the queue (BFS) and stack (DFS) update in real time
- Use the speed slider to control animation speed
- Click "Reset" to start over
About
BFS explores the graph level by level using a queue (FIFO), guaranteeing the shortest path in unweighted graphs. DFS explores deeply along each path using a stack (LIFO), useful for cycle detection and exhaustive path enumeration. Watch how the same graph produces different visit orders.