causaldag.classes.dag.DAG.is_reversible

DAG.is_reversible(i: Hashable, j: Hashable) → bool[source]

Check if the arc i -> j is reversible (aka covered), i.e., if pa(i) = pa(j) \setminus \{i\}

Parameters:
  • i – source of the arc
  • j – target of the arc
Returns:

Return type:

True if the arc is reversible, otherwise False.

Example

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