Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ianhi/bds-sampler
Cython bindings for a bi degree sequence graph generator
https://github.com/ianhi/bds-sampler
Last synced: 13 days ago
JSON representation
Cython bindings for a bi degree sequence graph generator
- Host: GitHub
- URL: https://github.com/ianhi/bds-sampler
- Owner: ianhi
- License: other
- Created: 2021-10-13T18:17:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T22:01:16.000Z (9 months ago)
- Last Synced: 2024-04-24T11:05:11.357Z (8 months ago)
- Language: C
- Size: 40 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BDS-sampler
[![License](https://img.shields.io/pypi/l/BDS-sampler.svg?color=green)](https://github.com/ianhi/BDS-sampler/raw/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/BDS-sampler.svg?color=green)](https://pypi.org/project/BDS-sampler)
[![Python Version](https://img.shields.io/pypi/pyversions/BDS-sampler.svg?color=green)](https://python.org)cython bindings for Charo Del Genio's bi-degree sequence generator (https://charodelgenio.weebly.com/directed-graph-sampling.html)
which are an implementation of the paper Constructing and sampling directed graphs with given degree sequences https://doi.org/10.1088/1367-2630/14/2/023012
## Install
```bash
pip install bds-sampler
```# Usage
```python
from bds_sampler import sample, make_degree_sequence
import numpy as npseq = np.array(
[
[1, 2],
[3, 2],
[4, 6],
[3, 3],
[5, 3],
[4, 4],
]
)print(sample(in_seq=seq[:, 0], out_seq=seq[:, 1], N_samples=10))
# or generate a random degree sequence with pareto distributed in and out degrees
seq = make_degree_sequence(N_nodes=15)
print(sample(in_seq=seq[:, 0], out_seq=seq[:, 1], N_samples=1))
```