Neural Ninjas Β· DSA Simulation Labs Β· Lab 29

πŸ’§βš‘ The BFS vs DFS Race

Same graph, same start, run side by side. BFS spreads outward evenly like a puddle of water β€” every neighbor of the current edge gets touched before going any further. DFS strikes like lightning β€” one path, as deep as it can go, before ever backtracking.

Visit Order

Controls

πŸ’§ BFSI finish an entire ring before starting the next one. Every neighbor of everyone I've touched gets touched too, all at once, before I go one step further out.
⚑ DFSI commit to one path and ride it all the way down. Only when I truly hit a dead end do I back up and try the next branch.
Pick a level above to begin.