3. Causal Graph Algorithms in PyWhy#
Pywhy-graphs provides data structures and methods for storing causal graphs, which are documented in Causal Graphs in PyWhy. We also provide a submodule for common graph algorithms in the form of functions that take a mixed-edge graph as input.
3.1. Core Algorithms#
|
Check G is a valid PAG. |
|
Possible ancestors of a source node. |
|
Possible descendants of a source node. |
|
Find the discriminating path for <..., a, u, c>. |
|
Check if <node1, node2, node3> path forms a definite non-collider. |
|
Check if the provided PAG is valid or not. |
|
Converts the provided mag into a pag using the FCI algorithm. |
|
Sample a MAG from a PAG using Zhang's algorithm. |
|
Checks if the provided graph is a valid Partial Ancestral Graph (PAG). |
|
Convert all bidirected edges to unobserved confounders. |
|
Check m-separation among 'x' and 'y' given 'z' in mixed-edge causal graph G, which may contain directed, bidirected, and undirected edges. |
|
Check if a set 'z' is a i-minimal m-separator between 'x' and 'y'. |
|
Find a i-minimal m-separating set 'z' between 'x' and 'y' in mixed-edge causal graph G. |
3.2. Algorithms for Markov Equivalence Classes#
|
Find all PDS sets between node_x and node_y. |
|
Compute the possibly-d-separating set path. |
|
Compute uncovered potentially directed (pd) paths from u to c. |
3.3. Algorithms for Time-Series Graphs#
|
Compute the possibly-d-separating set over time. |
|
Compute the possibly-d-separating path set over time. |
3.4. Algorithms for handling acyclicity#
|
Acyclify a cyclic graph. |
4. Semi-directed (possibly-directed) Paths#
|
Generate all semi-directed paths from source to target in G. |
|
Returns True if and only if |