causaldag.classes.dag.DAG.dsep

DAG.dsep(A: Union[Set[Hashable], Hashable], B: Union[Set[Hashable], Hashable], C: Union[Set[Hashable], Hashable] = {}, verbose=False, certify=False) → bool[source]

Check if A and B are d-separated given C, using the Bayes ball algorithm.

Parameters:
  • A – First set of nodes.
  • B – Second set of nodes.
  • C – Separating set of nodes.
  • verbose – If True, print moves of the algorithm.
Returns:
Return type:is_dsep

Example

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