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
XandYwhich belong toZare observed, hence separated from any node.- Parameters:
g (
DAG | CPDAG | MPDAG | EssentialGraph | PDAG | ChainGraph | MAG) – the graphX (
int | str | Iterable[int | str]) – the first node or set of nodesY (
int | str | Iterable[int | str]) – the second node or set of nodes, disjoint fromXZ (
int | str | Iterable[int | str] | None) – the separating node or set of nodes (None: the empty set)
- Returns:
True if
XandYare separated byZ- Return type:
bool- Raises:
pyagrum.InvalidArgument – if
XandYare not disjointpyagrum.InvalidNode – if a node id is not a node of the graph
pyagrum.NotFound – if a node name is not a name of the graph
References
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