DFS is an algorithm for traversing a graph by exhaustively visiting all nodes. It involves moving forward on path until there are no more unvisited nodes, then backtracking or move on to unvisited path.
1. Start at any node, such as the root node. 2. Mark the current node as visited.3. If immediate children of the node are not visited, recursively call function for that child.