In depth-first traversal (also called depth-first search), all nodes of a graph are visited by taking a path and going as deep as possible down that path. On reaching the end, you go back, pick up another path, and then repeat the process.
In this recipe, we will learn how to carry out the depth-first traversal of the graph.