Other DFS applications [00MJ]

There are many other applications of DFS—far too many to cover in this course! I will just list a few and let you look them up if you are interested.

  • DFS can be used to find articulation points (aka cut vertices) and bridges, i.e. vertices and edges whose removal would disconnect a graph.
  • DFS can be used to topologically sort a directed graph. We will learn a different algorithm for this later.
  • DFS can be used to find the strongly connected components of a directed graph; this is known as Kosaraju's algorithm.
  • Given a rooted tree, we can run DFS with a gobal "time" counter and label each vertex with the time we started processing it and the time we finished processing it. Then we can answer ancestry queries in \Theta (1)—to check whether vertex a is an ancestor of vertex b in the tree, just check whether b's start and end times lie within a's start and end times.