rustworkx.topological_generations#
- topological_generations(dag, /)#
Return the topological generations of a DAG
A topological generation is node collection in which ancestors of a node in each generation are guaranteed to be in a previous generation, and any descendants of a node are guaranteed to be in a following generation. Nodes are guaranteed to be in the earliest possible generation that they can belong to.
- Parameters:
graph (PyDiGraph) – The DAG to get the topological generations from
- Returns:
A list of topological generations.
- Return type:
list
- Raises:
DAGHasCycle – if a cycle is encountered while sorting the graph