Depth-first search (DFS)

This is a way of traversing a graph (could be a directed graph or undirected graph). It explores all the way down one branch of the graph before tracing and exploring other branches.

The generally runs in time.

Examples