Note

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.

rustworkx.descendants#

descendants(graph, node, /)#

Return the descendants of a node in a graph.

This differs from PyDiGraph.successors() method in that successors` returns only nodes with a direct edge out of the provided node. While this function returns all nodes that have a path from the provided node.

Parameters:
  • graph (PyDiGraph) – The graph to get the descendants from

  • node (int) – The index of the graph node to get the descendants for

Returns:

A set of node indices of descendants of provided node.

Return type:

set