is_d_separator#
- is_d_separator(G, x, y, z)[source]#
Return whether node sets
x
andy
are d-separated byz
.- Parameters:
- Gnx.DiGraph
A NetworkX DAG.
- xnode or set of nodes
First node or set of nodes in
G
.- ynode or set of nodes
Second node or set of nodes in
G
.- znode or set of nodes
Potential separator (set of conditioning nodes in
G
). Can be empty set.
- Returns:
- bbool
A boolean that is true if
x
is d-separated fromy
givenz
inG
.
- Raises:
- NetworkXError
The d-separation test is commonly used on disjoint sets of nodes in acyclic directed graphs. Accordingly, the algorithm raises a
NetworkXError
if the node sets are not disjoint or 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. Also colliders that are not inz
block a path. A collider structure along a path is... -> c <- ...
wherec
is the collider node.