causaldag.classes.dag.DAG.incident_arcs

DAG.incident_arcs(node: Hashable) → Set[Tuple[Hashable, Hashable]][source]

Return all arcs with node as either source or target.

Parameters:node – The node.
Returns:Return all arcs i->j such that either i=``node`` of j=``node``.
Return type:Set[arc]

Example

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