causaldag.classes.dag.DAG.sinks

DAG.sinks() → Set[Hashable][source]

Get all nodes in the graph that have no children.

Returns:Nodes in the graph that have no children.
Return type:List[node]

Example

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