pyrobopath.process.utilities.stratify_digraph#

pyrobopath.process.utilities.stratify_digraph(dg: DependencyGraph, delta=1) List[DependencyGraph][source]#

Stratify a directed graph into subgraphs grouped by topological generation.

Each subgraph contains up to delta consecutive topological generation. Nodes within each generation are from the same depth in dg. They do not depend on each other and only depend on nodes from earlier generations.

Parameters:
  • dg (DependencyGraph) – The dependency graph to be stratified.

  • delta (int) – The max number of consecutive topological generations in each subgraph.

Returns:

subgraphs – A list of subgraphs, each containing nodes from one generation level of the graph.

Return type:

List[DependencyGraph]