Depth-first search (DFS)
programming
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 $O(\vert V \vert + \vert E \vert)$ time.