causaldag.classes.dag.DAG.markov_equivalent

DAG.markov_equivalent(other, interventions=None) → bool[source]

Check if this DAG is (interventionally) Markov equivalent to the DAG other.

Parameters:
  • other – Another DAG.
  • interventions – If not None, check whether the two DAGs are interventionally Markov equivalent under the interventions.

Examples

>>> import causaldag as cd
>>> d1 = cd.DAG(arcs={(0, 1), (1, 2)})
>>> d2 = cd.DAG(arcs={(2, 1), (1, 0)})
>>> d3 = cd.DAG(arcs={(0, 1), (2, 1)})
>>> d4 = cd.DAG(arcs={(1, 0), (1, 2)})
>>> d1.markov_equivalent(d2)
True
>>> d2.markov_equivalent(d1)
True
>>> d1.markov_equivalent(d3)
False
>>> d1.markov_equivalent(d2, [{2}])
False
>>> d1.markov_equivalent(d4, [{2}])
True