Skip to main content Accessibility help
×
Hostname: page-component-78c5997874-j824f Total loading time: 0 Render date: 2024-11-03T05:11:51.446Z Has data issue: false hasContentIssue false

Appendix B - Strongly Connected Components of a Graph

Published online by Cambridge University Press:  05 August 2016

Malik Ghallab
Affiliation:
Centre National de la Recherche Scientifique (CNRS), Paris
Dana Nau
Affiliation:
University of Maryland, College Park
Paolo Traverso
Affiliation:
FBK ICT – IRST (Center for Scientific and Technological Research), Italy
Get access

Summary

Let G = (V,E) be a directed graph. A strongly connected component of G is a subset C of V such that every vertex of C is reachable from every other vertex of C. The relation ∼ on vertices can be defined as follows: υυ' iff either υ = υ' or υ is reachable from υ' and υ' is reachable from υ. It is an equivalence relation on V. It partitions V into equivalence classes, each being a strongly connected component of G. Furthermore, the set of strongly connected components of G is a directed acyclic graph that has an edge from C to C' when there is a vertex in C' reachable from a vertex in C.

The Tarjan algorithm [560] finds in a single depth-first traversal of G its strongly connected components.Each vertex is visited just once.Hence the traversal organizesG as a spanning forest.Some subtrees of this forest are the strongly connected components of G. During the traversal, the algorithm associates two integers to each new vertex υ it meets:

  1. • index(υ): the order in which υ is met in the traversal, and

  2. • low(υ) = min﹛index(υ') |υ' reachable from υ

It is shown that index(υ)=low(υ) iff υ and all its successors in a traversal subtree are a strongly connected component of G.

This is implemented in Algorithm B.1 as a recursive procedure with a stack mechanism. At the end of a recursion on a vertex υ, if the condition index(υ)=low(υ) holds, then υ and all the vertices above υ in the stack (i.e., those below υ in the depth-first traversal tree) constitute a strongly connected component of G.

With the appropriate initialization (i ← 0, stack ← ∅ and index undefined everywhere), Tarjan(υ) is called once for every υV such that index(υ) is undefined. The algorithm run in 0(|V| + |E|). It finds all the strongly connected components of G in the reverse order of the topological sort of the DAG formed by the components, that is, if (C,C') is an edge of this DAG, then C' will be found before C.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2016

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×