graph.separation

pyagrum.graph.separation(g, X, Y, Z=None)

Whether two sets of nodes are separated by a third one, with the criterion of the class of the graph.

graph

criterion

DAG, CPDAG, MPDAG, EssentialGraph

d-separation (in the DAGs of the class)

PDAG, ChainGraph

c-separation

MAG

m-separation

The three criteria are equal on a DAG. The nodes of X and Y which belong to Z are observed, hence separated from any node.

Parameters:
  • g (DAG | CPDAG | MPDAG | EssentialGraph | PDAG | ChainGraph | MAG) – the graph

  • X (int | str | Iterable[int | str]) – the first node or set of nodes

  • Y (int | str | Iterable[int | str]) – the second node or set of nodes, disjoint from X

  • Z (int | str | Iterable[int | str] | None) – the separating node or set of nodes (None: the empty set)

Returns:

True if X and Y are separated by Z

Return type:

bool

Raises:

References

    1. Pearl. Probabilistic Reasoning in Intelligent Systems. Morgan Kaufmann, 1988 (d-separation).

  • R. R. Bouckaert, M. Studený. Chain graphs: semantics and expressiveness. ECSQARU 1995, LNCS 946, pp. 69-76 (c-separation).

  • T. Richardson, P. Spirtes. Ancestral graph Markov models. The Annals of Statistics 30(4):962-1030, 2002 (m-separation).

Example

import pyagrum as gum
import pyagrum.graph as gg

dag = gum.fastDAG("A->C<-B")
gg.separation(dag, "A", "B")
# True
gg.separation(dag, "A", "B", "C")
# False
chain = gum.fastChainGraph("A->B-C<-D")  # the parents of the chain component {B, C} are married
gg.separation(chain, "A", "D", "B")
# False