Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gravins/numgraph
Synthetic graph generator
https://github.com/gravins/numgraph
graphs numpy python
Last synced: about 2 months ago
JSON representation
Synthetic graph generator
- Host: GitHub
- URL: https://github.com/gravins/numgraph
- Owner: gravins
- License: mit
- Created: 2021-11-24T09:40:44.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-07T16:29:11.000Z (about 1 year ago)
- Last Synced: 2024-11-08T00:18:18.599Z (about 2 months ago)
- Topics: graphs, numpy, python
- Language: Python
- Homepage: https://numgraph.readthedocs.io
- Size: 582 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[pypi-image]: https://github.com/gravins/NumGraph/blob/main/docs/source/_static/img/NumGraph_logo.svg
[pypi-url]: https://pypi.org/project/numgraph/
# NumGraph
#### Read the [Documentation](https://numgraph.readthedocs.io/en/latest/index.html)**Num(py)Graph** is a library for synthetic graph generation. The main principle of NumGraph is to be a lightweight library (i.e., ``numpy`` is the only dependency) that generates graphs from a broad range of distributions. Indeed, It implements several graph distributions in both the static and temporal domain.
## Implemented distributions
### Static Graphs
- Star graph
- Clique
- Two-dimensional rectangular grid lattice graph
- Random Tree
- Erdos Renyi
- Barabasi Albert
- Stochastic Block Model### Temporal Graphs
- Susceptible-Infected Dissemination Process Simulation
- Heat diffusion over a graph (closed form solution)
- Generic Euler's method approximation of a diffusion process over a graph## Installation
``` python3 -m pip install numgraph ```
## Usage
```python>>> from numgraph import star_coo, star_full
>>> coo_matrix, coo_weights = star_coo(num_nodes=5, weighted=True)
>>> print(coo_matrix)
array([[0, 1],
[0, 2],
[0, 3],
[0, 4],
[1, 0],
[2, 0],
[3, 0],
[4, 0]]>>> print(coo_weights)
array([[0.89292422],
[0.3743427 ],
[0.32810002],
[0.97663266],
[0.74940571],
[0.89292422],
[0.3743427 ],
[0.32810002],
[0.97663266],
[0.74940571]])>>> adj_matrix = star_full(num_nodes=5, weighted=True)
>>> print(adj_matrix)
array([[0. , 0.72912008, 0.33964166, 0.30968042, 0.08774328],
[0.72912008, 0. , 0. , 0. , 0. ],
[0.33964166, 0. , 0. , 0. , 0. ],
[0.30968042, 0. , 0. , 0. , 0. ],
[0.08774328, 0. , 0. , 0. , 0. ]])```
Other examples can be found in ``` test/plot_static.py ``` and ``` test/plot_temporal.py ```.