graphical_models.classes.dags.dag.DAG.dsep_from_given

DAG.dsep_from_given(A, C: Union[Hashable, Set[Hashable]] = frozenset({})) Set[Hashable][source]

Find all nodes d-separated from A given C.

Uses algorithm in Geiger, D., Verma, T., & Pearl, J. (1990). Identifying independence in Bayesian networks. Networks, 20(5), 507-534.

Parameters
  • A – set of nodes.

  • C – set of conditioned nodes.

Returns

Nodes which are d-separated from A given C.

Return type

set

Examples

>>> from graphical_models import DAG
>>> d = DAG(arcs={(0, 1), (1, 2), (2, 3), (3, 4)})
>>> d.dsep_from_given(0, 1)
{2, 3, 4]