[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![CircleCI](https://circleci.com/gh/py-why/pywhy-graphs/tree/main.svg?style=svg)](https://circleci.com/gh/py-why/pywhy-graphs/tree/main)
[![unit-tests](https://github.com/py-why/pywhy-graphs/actions/workflows/main.yml/badge.svg)](https://github.com/py-why/pywhy-graphs/actions/workflows/main.yml)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![codecov](https://codecov.io/gh/py-why/pywhy-graphs/branch/main/graph/badge.svg?token=H1reh7Qwf4)](https://codecov.io/gh/py-why/pywhy-graphs)
# PyWhy-Graphs
pywhy-graphs is a Python graph library that extends [networkx](https://github.com/networkx/networkx) with the notion of a `MixedEdgeGraph` to implement a light-weight API for causal graphical structures that contain mixed-edges and contain causal graph traversal algorithms.
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 https://github.com/networkx/networkx/pull/5947
## Why?
Representation of causal graphical models in Python are severely lacking.
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.
Existing packages that aim to represent causal graphs either break from the networkX API, or only implement a subset of the relevant causal graphs. By keeping in-line with the robust NetworkX API, we aim to ensure a consistent user experience and a gentle introduction to causal graphical models. A `MixedEdgeGraph` instance is a composition of networkx graphs and has a similar API, with the additional notion of an "edge type", which specifies what edge type subgraph any function should operate over. For example:
```Python
# adds a directed edge from x to y
G.add_edge('x', 'y', edge_type='directed')
# adds a bidirected edge from x to y
G.add_edge('x', 'y', edge_type='bidirected')
```
Moreover, sampling from causal models is non-trivial, but a requirement for benchmarking many causal algorithms in discovery, ID, estimation and more. We aim to provide simulation modules that are easily connected with causal graphs to provide a simple robust API for modeling causal graphs and then simulating data.
# Documentation
See the [development version documentation](https://py-why.github.io/pywhy-graphs/dev/index.html).
Or see [stable version documentation](https://py-why.github.io/pywhy-graphs/stable/index.html)
# Installation
Installation is best done via `pip` or `conda`. For developers, they can also install from source using `pip`. See [installation page](https://py-why.github.io/pywhy-graphs/dev/installation.html) for full details.
## Dependencies
We aim to provide a very light-weight dependency structure. Minimally, pywhy-graphs requires:
* Python (>=3.8)
* numpy
* scipy
* networkx
Additional functionality may be required when running unit-tests and documentation.
## User Installation
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 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
# Contributing
Pywhy-Graphs is always looking for new contributors to help make the package better, whether it is algorithms, documentation, examples of graph usage, and more! Contributing to Pywhy-Graphs will be rewarding because you will contribute to a much needed package for causal inference.
See our [contributing guide](https://github.com/py-why/pywhy-graphs/CONTRIBUTING.md) for more details.
Raw data
{
"_id": null,
"home_page": "https://github.com/py-why/pywhy-graphs",
"name": "pywhy-graphs",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<3.12",
"maintainer_email": "",
"keywords": "causality,graphs,causal-inference,graphical-model",
"author": "PyWhy Community",
"author_email": "adam.li@columbia.edu",
"download_url": "https://files.pythonhosted.org/packages/23/28/58a207ec5df8fc8515cffc49c9512a0803e8cbd1703888c76221133a7439/pywhy_graphs-0.1.0.tar.gz",
"platform": null,
"description": "[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![CircleCI](https://circleci.com/gh/py-why/pywhy-graphs/tree/main.svg?style=svg)](https://circleci.com/gh/py-why/pywhy-graphs/tree/main)\n[![unit-tests](https://github.com/py-why/pywhy-graphs/actions/workflows/main.yml/badge.svg)](https://github.com/py-why/pywhy-graphs/actions/workflows/main.yml)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n[![codecov](https://codecov.io/gh/py-why/pywhy-graphs/branch/main/graph/badge.svg?token=H1reh7Qwf4)](https://codecov.io/gh/py-why/pywhy-graphs)\n\n# PyWhy-Graphs\n\npywhy-graphs is a Python graph library that extends [networkx](https://github.com/networkx/networkx) with the notion of a `MixedEdgeGraph` to implement a light-weight API for causal graphical structures that contain mixed-edges and contain causal graph traversal algorithms.\n\nNote: 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 https://github.com/networkx/networkx/pull/5947\n\n## Why?\n\nRepresentation of causal graphical models in Python are severely lacking.\n\nPyWhy-Graphs implements a graphical API layer for ADMG, CPDAG and PAG. For causal DAGs, we recommend using the `networkx.DiGraph` class and\nensuring acylicity via `networkx.is_directed_acyclic_graph` function.\n\nExisting packages that aim to represent causal graphs either break from the networkX API, or only implement a subset of the relevant causal graphs. By keeping in-line with the robust NetworkX API, we aim to ensure a consistent user experience and a gentle introduction to causal graphical models. A `MixedEdgeGraph` instance is a composition of networkx graphs and has a similar API, with the additional notion of an \"edge type\", which specifies what edge type subgraph any function should operate over. For example:\n\n```Python\n# adds a directed edge from x to y\nG.add_edge('x', 'y', edge_type='directed')\n\n# adds a bidirected edge from x to y\nG.add_edge('x', 'y', edge_type='bidirected')\n```\n\nMoreover, sampling from causal models is non-trivial, but a requirement for benchmarking many causal algorithms in discovery, ID, estimation and more. We aim to provide simulation modules that are easily connected with causal graphs to provide a simple robust API for modeling causal graphs and then simulating data.\n\n# Documentation\n\nSee the [development version documentation](https://py-why.github.io/pywhy-graphs/dev/index.html).\n\nOr see [stable version documentation](https://py-why.github.io/pywhy-graphs/stable/index.html)\n\n# Installation\n\nInstallation is best done via `pip` or `conda`. For developers, they can also install from source using `pip`. See [installation page](https://py-why.github.io/pywhy-graphs/dev/installation.html) for full details.\n\n## Dependencies\n\nWe aim to provide a very light-weight dependency structure. Minimally, pywhy-graphs requires:\n\n * Python (>=3.8)\n * numpy\n * scipy\n * networkx\n\nAdditional functionality may be required when running unit-tests and documentation.\n\n## User Installation\n\nIf you already have a working installation of numpy, scipy and networkx, the easiest way to install pywhy-graphs is using `pip`:\n\n # doesn't work until we make an official release :p\n pip install -U pywhy-graphs\n\nTo install the package from github, clone the repository and then `cd` into the directory. You can then use `poetry` to install:\n\n poetry install\n\n # for vizualizing graph functionality\n poetry install --extras viz\n\n # if you would like an editable install of dodiscover for dev purposes\n pip install -e .\n\n pip install https://api.github.com/repos/py-why/pywhy-graphs/zipball/main\n\n# Contributing\n\nPywhy-Graphs is always looking for new contributors to help make the package better, whether it is algorithms, documentation, examples of graph usage, and more! Contributing to Pywhy-Graphs will be rewarding because you will contribute to a much needed package for causal inference.\n\nSee our [contributing guide](https://github.com/py-why/pywhy-graphs/CONTRIBUTING.md) for more details.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Causal Graphs for Python",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://py-why.github.io/pywhy-graphs",
"Homepage": "https://github.com/py-why/pywhy-graphs",
"Repository": "https://github.com/py-why/pywhy-graphs"
},
"split_keywords": [
"causality",
"graphs",
"causal-inference",
"graphical-model"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a07861bb6bc594d616b98220efad9f25231d7915d562e12d431d215cef4fecfd",
"md5": "5296ad01deb12a650ca71e1949bdba96",
"sha256": "a7957bed5dbce6619712cad174b922b9f793de2e641d2aa6d7b71a780302620c"
},
"downloads": -1,
"filename": "pywhy_graphs-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5296ad01deb12a650ca71e1949bdba96",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<3.12",
"size": 138768,
"upload_time": "2023-07-06T18:41:38",
"upload_time_iso_8601": "2023-07-06T18:41:38.467464Z",
"url": "https://files.pythonhosted.org/packages/a0/78/61bb6bc594d616b98220efad9f25231d7915d562e12d431d215cef4fecfd/pywhy_graphs-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "232858a207ec5df8fc8515cffc49c9512a0803e8cbd1703888c76221133a7439",
"md5": "a76f10e1965340046ca9db1c195af5b2",
"sha256": "175107f9dce19aba21ed962bc0cf5ebfec55528dee790d0cf89be1e905c5cb2c"
},
"downloads": -1,
"filename": "pywhy_graphs-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "a76f10e1965340046ca9db1c195af5b2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<3.12",
"size": 106417,
"upload_time": "2023-07-06T18:41:40",
"upload_time_iso_8601": "2023-07-06T18:41:40.946048Z",
"url": "https://files.pythonhosted.org/packages/23/28/58a207ec5df8fc8515cffc49c9512a0803e8cbd1703888c76221133a7439/pywhy_graphs-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-06 18:41:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "py-why",
"github_project": "pywhy-graphs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"circle": true,
"lcname": "pywhy-graphs"
}