networkx.algorithms.d_separation.d_separated¶
-
d_separated(G: networkx.classes.digraph.DiGraph, x: AbstractSet, y: AbstractSet, z: AbstractSet) → bool[source]¶ Return whether node sets
xandyare d-separated byz.- Parameters
G (graph) – A NetworkX DAG.
x (set) – First set of nodes in
G.y (set) – Second set of nodes in
G.z (set) – Set of conditioning nodes in
G. Can be empty set.
- Returns
b – A boolean that is true if
xis d-separated fromygivenzinG.- Return type
- Raises
NetworkXError – The d-separation test is commonly used with directed graphical models which are acyclic. Accordingly, the algorithm raises a
NetworkXErrorif the input graph is not a DAG.NodeNotFound – If any of the input nodes are not found in the graph, a
NodeNotFoundexception is raised.