|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Topological sorting algorithms for directed acyclic graphs (DAGs). More...
Go to the source code of this file.
Classes | |
| class | Aleph::Topological_Sort< GT, Itor, SA > |
| Computes topological ordering using depth-first search. More... | |
| class | Aleph::Q_Topological_Sort< GT, Itor, SA > |
| Computes topological ordering using breadth-first search (Kahn's algorithm). More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Topological sorting algorithms for directed acyclic graphs (DAGs).
This header provides two implementations of topological sorting:
Topological_Sort: Uses depth-first search with postfix ordering. Visits nodes recursively and inserts them in reverse postorder.Q_Topological_Sort: Uses breadth-first search (Kahn's algorithm). Repeatedly removes source nodes (in-degree 0) and updates degrees. Also provides rank-based ordering for parallel execution.Both algorithms assume the input is a DAG. Behavior is undefined if the graph contains cycles.
Definition in file topological_sort.H.