This lab will allow you to test your knowledge of what you saw earlier in Depth-First Search (DFS) and Breadth-First Search (BFS) with practical examples. The default graph mirrors the article's A-through-H example, starts at node A, and looks for a path to node F. Generate unweighted node networks, switch between DFS and BFS, and step through how each traversal decides which node to explore next.
DFS: A to F
Generate a graph or find a path to begin.
Tip: drag nodes to rearrange the graph. Use Customize to generate graphs, add nodes, connect edges, and choose the start and target nodes.
| Step | What Happened |
|---|
No run yet.
| Node | Discovered From | Visit Order | Status |
|---|
DFS and BFS can both search the same connected graph, but they make different choices about the next node to visit. DFS treats the discovered list like a stack by putting newly found nodes at the front. BFS treats it like a queue by putting newly found nodes at the back.
The initial graph matches the article example, but this lab gives it a concrete goal: find a path from A to F. BFS will find the fewest-edge path, while DFS may find a perfectly valid path that depends more heavily on the order neighbors are discovered.
If you need a quick refresher, revisit the Depth-First Search (DFS) and Breadth-First Search (BFS) walkthrough and then come back here to compare the two approaches step by step.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

:: Copyright KIRUPA 2026 //--