|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Topological sorting algorithms for directed acyclic graphs (DAGs). More...
#include <ah-graph-concepts.H>#include <tpl_dfs_stack.H>#include <tpl_dynListQueue.H>#include <tpl_graph.H>Go to the source code of this file.
Classes | |
| class | Aleph::Topological_Sort< GT, Itor, SA > |
| Computes topological ordering using depth-first search. More... | |
| struct | Aleph::Topological_Sort< GT, Itor, SA >::Frame |
| 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 in depth and inserts them in reverse postorder, without recursion.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.