rustworkx.PyDiGraph.find_predecessors_by_edge#

PyDiGraph.find_predecessors_by_edge(node, filter_fn, /)#

Return a filtered list of predecessor data such that each node has at least one edge data which matches the filter.

Parameters:
  • node (int) – The index for the node to get the predecessor for

  • filter_fn – The filter function to use for matching nodes. It takes in one argument, the edge data payload/weight object, and will return a boolean whether the edge matches the conditions or not. If any edge returns True, the node will be included.

Returns:

A list of the node data for all the parent neighbor nodes whose at least one edge matches the filter

Return type:

list