Strong Components in Linear Time Continued
Understand how these techniques can improve the efficiency of the algorithm.
We'll cover the following...
Tarjan’s algorithm
An earlier but considerably more subtle linear-time algorithm to compute strong components was published by Bob Tarjan in 1972. Intuitively, Tarjan’s algorithm identifies a source component of , “deletes” it, and then “recursively” finds the remaining strong components; however, the entire computation happens during a single depth-first search.
Characterizing sink components in a directed graph
Fix an arbitrary depth-first traversal of some directed graph . For each vertex , let denote the smallest starting time among all vertices reachable from by a path of tree edges followed by, at most, one non-tree edge. Trivially, , because can reach itself through zero tree edges followed by zero non-tree edges. Tarjan observed that sink components could be characterized in terms of this low function.
Lemma: A vertex is the root of a sink component of if and only if and for every proper descendant of .
Proof: First, let be a vertex such that . Then there is no edge where is a descendant of and . On the other hand, cannot reach any vertex such that . It follows that can reach only its descendants, and therefore any descendant of can reach only descendants of . In particular, cannot reach its parent (if it has one), so is the root of its strong component.
Now suppose in addition that ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy