Figure 7:
Depth-first search.