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 aADMGinstance instead.It first converts all bidirected edges into explicit unobserved confounding nodes in an explicit
networkx.DiGraph, which then callsnetworkx.algorithms.d_separatedto determine d-separation. This inherently increases the runtime cost if there are many bidirected edges, because many nodes must be added.- Parameters:
G :
ADMGCausal graph.
x :
setFirst set of nodes in
G.y :
setSecond set of nodes in
G.z :
setSet of conditioning nodes in
G. Can be empty set.
Notes
This wraps the networkx implementation, which only allows DAGs. Since
ADMGis not represented.