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.
- ancestors(graph, node, /)#
Return the ancestors of a node in a graph.
This differs from
PyDiGraph.predecessors()method in that
predecessorsreturns only nodes with a direct edge into the provided node. While this function returns all nodes that have a path into the provided node.
graph (PyDiGraph) – The graph to get the ancestors from.
node (int) – The index of the graph node to get the ancestors for
A set of node indices of ancestors of provided node.
- Return type: