pywhy-graphs is a Python graph library that extends MixedEdgeGraph
in networkx to implement a light-weight API for causal graphical structures.
Note: The API is subject to change without deprecation cycles due to the current work-in-progress MixedEdgeGraph
class in networkx. For more information, follow the PR at networkx/networkx#5947
Representation of causal inference models in Python are severely lacking. Moreover, sampling from causal models is non-trivial. However, sampling from simulations is a requirement to benchmark different structural learning, causal ID, or other causal related algorithms.
PyWhy-Graphs implements a graphical API layer for ADMG, CPDAG and PAG. For causal DAGs, we recommend using the networkx.DiGraph
class and
ensuring acylicity via networkx.is_directed_acyclic_graph
function.
See the development version documentation.
Or see stable version documentation
Installation is best done via pip
or conda
. For developers, they can also install from source using pip
. See installation page for full details.
Minimally, pywhy-graphs requires:
* Python (>=3.8)
* numpy
* scipy
* networkx
If you already have a working installation of numpy, scipy and networkx, the easiest way to install pywhy-graphs is using pip
:
# doesn't work until we make an official release :p
pip install -U pywhy-graphs
To install the package from github, clone the repository and then cd
into the directory. You can then use poetry
to install:
poetry install
# for time-series graph functionality
poetry install --extras ts
# for vizualizing graph functionality
poetry install --extras viz
# if you would like an editable install of dodiscover for dev purposes
pip install -e .
pip install https://api.github.com/repos/py-why/pywhy-graphs/zipball/main