1. Description
DFS is a recursive or stack-based algorithm used to traverse or search through a graph/tree. The following is ususally the steps for DFS to traverse all the nodes in the graph.
1. Start at a node (usually the source). 2. Mark the node as visited. 3. Recursively (or via stack) visit each unvisited neighbor. 4. Backtrack when all neighbors are explored.