Warning
The documentation for retworkx has migrated to:
https://qiskit.org/documentation/retworkx
These docs will no longer be updated.
retworkx.ancestors¶
- ancestors(graph, node, /)¶
Return the ancestors of a node in a graph.
This differs from
PyDiGraph.predecessors()
method in thatpredecessors
returns only nodes with a direct edge into the provided node. While this function returns all nodes that have a path into the provided node.- Parameters
graph (PyDiGraph) – The graph to get the descendants from
node (int) – The index of the graph node to get the ancestors for
- Returns
A list of node indexes of ancestors of provided node.
- Return type
list