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