Applications of DFS:
– The two orderings are advantageous for
various applications like topological
sorting, etc.
– To check connectivity of a graph (number
of times stack becomes empty tells the
number of components in the graph)
– To check if a graph is acyclic. (no back
edges indicates no cycle)
– To find articulation point in a graph.