rustworkx.PyDAG.find_predecessor_node_by_edge#

PyDAG.find_predecessor_node_by_edge(node, predicate, /)#

Find a source node with a specific edge

This method is used to find a predecessor of a given node given an edge condition.

Parameters:
  • node (int) – The node to use as the source of the search

  • predicate (callable) – A python callable that will take a single parameter, the edge object, and will return a boolean if the edge matches or not

Returns:

The node object that has an edge from it to the provided node index which matches the provided condition