Welcome to the documentation of our Python library for estimating graphons from observed data! Our library provides a powerful set of tools for estimating graphons, which are a type of object used to model large, random graphs, from observed data.
from pygraphon import HistogramEstimator
# sample a graph with n nodes from one of the built-in graphons f(x,y) = x*y
from pygraphon import graphon_graphon_product
A = graphon_product.draw(n = 100)
# Create a histogram estimator
estimator = HistogramEstimator()
# Fit the estimator to a graph with adjacency matrix A
estimator.fit(A)
# Get the estimated graphon
graphon_estimated = estimator.get_graphon()
# get the estimated block connectivity matrix
theta = graphon_estimated.get_theta()
# get the estimated edge probability matrix
P_estimated = graphon_estimated.get_edge_connectivity()To cite this library, please use the following citation:
@misc{dufour_verdeyme_2023,
author = {Dufour, Charles and Verdeyme, Arthur},
title = {PyGraphon},
year = {2023},
howpublished = {https://doi.org/10.5281/zenodo.10355247},
note = {Zenodo},
doi = {10.5281/zenodo.10355247}
}See Installation instructions
The most recent release can be installed from [PyPI](https://pypi.org/project/pygraphon/) with:$ pip install pygraphon-->
The most recent code and data can be installed directly from GitHub with:
$ pip install git+https://github.com/dufourc1/pygraphon.gitTo install in development mode, use the following:
$ git clone git+https://github.com/dufourc1/pygraphon.git
$ cd pygraphon
$ pip install -e .Contributions, whether filing an issue, making a pull request, or forking, are appreciated. See CONTRIBUTING.rst for more information on getting involved.
See Attributions
The code in this package is licensed under the MIT License.
This package was created with @audreyfeldroy's cookiecutter package using @cthoyt's cookiecutter-snekpack template.
See developer instructions
The final section of the README is for if you want to get involved by making a code contribution.
After cloning the repository and installing uv (see uv installation), the unit tests in the tests/ folder can be run reproducibly with:
$ uv run pytest testsAdditionally, these tests are automatically re-run with each commit in a GitHub Action.
### 📝 Documentation
The documentation is built with Sphinx. After installing the package in development mode, the documentation can be built locally with:
$ cd docs
$ make htmlThe documentation will then be available in docs/build/html/.
To build the documentation, you'll need to install the necessary dependencies. This can be done with:
$ uv sync --all-extrasnote: to correctly format the documentation, one can use tool such as rstfmt (installable with uv pip install rstfmt).