search algorithm code
how the DFS code works:
- To begin, we'll place any of the graph's vertices on top of the stack.
- The top item in the stack should then be added to the vertex's visited list.
- Next, make a list of the vertex's nearby nodes. Stack the ones that aren't in the visited list of vertices at the top.
- Finally, repeat steps 2 and 3 until the stack is depleted.