

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Breadth First Search (BFS)
incomplete
2: Complete Graph
incomplete
3: Depth First Search (DFS)
incomplete
4: DFS vs. BFS
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Depth-first search (DFS) is just another algorithm to traverse a graph - kind of like breadth first search. It starts at a root node (some arbitrary node on the graph) and explores as far as possible along each branch before backtracking and starting down the next branch.
The provided image depicting Depth First Search (DFS) is illustrative and not directly related to the specific code assignment in this lesson.
Try stepping through a small graph:
Interactive example available with JavaScript enabled.
The LockedIn executives want us to add a depth-first search feature to geographic search.
Complete the depth_first_search and depth_first_search_r methods. The depth_first_search_r method is a recursive helper method for depth_first_search.
depth_first_search_r with the neighboring vertex