d_separated#

d_separated(G, x, y, z)[source]#

Return whether node sets x and y are d-separated by z.

Parameters:
Ggraph

A NetworkX DAG.

xset

First set of nodes in G.

yset

Second set of nodes in G.

zset

Set of conditioning nodes in G. Can be empty set.

Returns:
bbool

A boolean that is true if x is d-separated from y given z in G.

Raises:
NetworkXError

The d-separation test is commonly used with directed graphical models which are acyclic. Accordingly, the algorithm raises a NetworkXError if the input graph is not a DAG.

NodeNotFound

If any of the input nodes are not found in the graph, a NodeNotFound exception is raised.

Notes

A d-separating set in a DAG is a set of nodes that blocks all paths between the two sets. Nodes in z block a path if they are part of the path and are not a collider, or a descendant of a collider. A collider structure along a path is ... -> c <- ... where c is the collider node.

https://en.wikipedia.org/wiki/Bayesian_network#d-separation