causal_networkx.algorithms.d_separated#
- causal_networkx.algorithms.d_separated(G, x, y, z=None)[source]#
Check d-separation among ‘x’ and ‘y’ given ‘z’ in graph G.
This algorithm wraps
networkx.algorithms.d_separated
, but allows one to pass in aADMG
instance instead.It first converts all bidirected edges into explicit unobserved confounding nodes in an explicit
networkx.DiGraph
, which then callsnetworkx.algorithms.d_separated
to determine d-separation. This inherently increases the runtime cost if there are many bidirected edges, because many nodes must be added.- Parameters:
G :
ADMG
Causal graph.
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.
Notes
This wraps the networkx implementation, which only allows DAGs. Since
ADMG
is not represented.