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

Return type

True if the arc is reversible, otherwise False.

Example

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