graphical_models.classes.dags.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

>>> from graphical_models import DAG
>>> g = DAG(arcs={(1, 2), (2, 3)})
>>> g.descendants_of(1)
{2, 3}