|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Tarjan's algorithm for strongly connected components. More...
#include <tpl_dynListStack.H>#include <tpl_dynSetTree.H>#include <htlist.H>#include <tpl_graph_utils.H>#include <tpl_find_path.H>#include <ah-errors.H>Go to the source code of this file.
Classes | |
| class | Aleph::Tarjan_Connected_Components< GT, Itor, SA > |
| Computes strongly connected components (SCCs) in a directed graph using Tarjan's algorithm. More... | |
| struct | Aleph::Tarjan_Connected_Components< GT, Itor, SA >::Init_Tarjan_Node |
| Functor to initialize node metadata for Tarjan traversal. More... | |
| class | Aleph::Compute_Cycle_In_Digraph< GT, Itor, SA > |
| Determines if a digraph contains a cycle and constructs it. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Tarjan's algorithm for strongly connected components.
This file implements Tarjan's algorithm for finding strongly connected components (SCCs) in directed graphs. An SCC is a maximal subset of vertices where every vertex is reachable from every other vertex.
Tarjan's algorithm uses a single DFS traversal with a stack to identify SCCs. Each node is assigned:
When lowlink[v] == index[v], v is the root of an SCC.
| Operation | Time | Space |
|---|---|---|
| Find all SCCs | O(V + E) | O(V) |
| Build condensation | O(V + E) | O(V + E) |
Definition in file Tarjan.H.