This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.


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.

  • 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.


a list of runs, where each run is a list of node data payload/weight for the nodes in the run

Return type: