Depth First Search on Graphs
Prereq: Graph Intro
We build on DFS on trees.
Similar to BFS, we just have to add visited
to keep track of the visited nodes and use get_neighbors
to get the next nodes to visit.
Here's a visualization of the recursive call stack during DFS on a graph: