causaldag.classes.dag.DAG.descendants_of

DAG.descendants_of(nodes: Union[Hashable, Set[Hashable]]) → Set[Hashable][source]

Return the descendants of node.

Parameters:nodes – The node.

See also

ancestors_of()

Returns:Return all nodes j such that there is a directed path from node to j.
Return type:Set[node]

Example

>>> import causaldag as cd
>>> g = cd.DAG(arcs={(1, 2), (2, 3)})
>>> g.descendants_of(1)
{2, 3}