networkx.algorithms.dag.descendants

descendants(G, source)[source]

Return all nodes reachable from source in G.

Parameters:
  • G (NetworkX DiGraph) – A directed acyclic graph (DAG)
  • source (node in G)
Returns:

The descendants of source in G

Return type:

set()