rustworkx.collect_runs#
- collect_runs(graph, filter_fn)#
Collect runs that match a filter function
A run is a path of nodes where there is only a single successor and all nodes in the path match the given condition. Each node in the graph can appear in only a single run.
- Parameters:
graph (PyDiGraph) – The graph to find runs in
filter_fn – The filter function to use for matching nodes. It takes in one argument, the node data payload/weight object, and will return a boolean whether the node matches the conditions or not. If it returns
False
it will skip that node.
- Returns:
a list of runs, where each run is a list of node data payload/weight for the nodes in the run
- Return type:
list