networkx.algorithms.dag.descendants

descendants(G, source)[source]

Returns all nodes reachable from source in G.

Parameters
GNetworkX DiGraph

A directed graph

sourcenode in G
Returns
set()

The descendants of source in G