BiWES – Bipartite Weighted Edge Shuffling: randomisation of bipartite weighted graphs preserving degree and weight sequences.
Project description
BiWES — Bipartite Weighted Edge Shuffling
A Python library for randomising bipartite weighted graphs while preserving their degree and weight sequences.
Installation
pip install -e .
Quick start
import numpy as np
from biwes import BiWES, BiWES2, pre_compute, find_configurations
# Create a simple bi-adjacency matrix
A = np.array([
[2, 3, 0],
[0, 1, 4],
[1, 0, 2],
], dtype=np.int64)
# Run 1000 randomisation steps (single call)
A_rand = BiWES(A, 1_000)
# --- or reuse pre-computed structures for many runs ---
A2, weight_dict, weight_dict2, adj_list, adj_list2, uw, uw2 = pre_compute(A)
A_rand2 = BiWES2(A2, weight_dict, weight_dict2, uw, uw2, adj_list, adj_list2, 1_000)
# Enumerate all configurations for a tiny graph
solutions = find_configurations([3, 4], [3, 4], [2, 2], [2, 2])
API
| Symbol | Description |
|---|---|
pre_compute(A) |
Pre-compute all internal data structures for a bi-adjacency matrix |
BiWES(A, n_iter) |
Randomise A in a single call |
BiWES2(A2, …, n_iter) |
Randomise using already-computed structures (efficient for multiple runs) |
find_configurations(s_row, s_col, d_row, d_col) |
Enumerate all integer matrices with given row/column strengths and degrees |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
biwes-0.1.0.tar.gz
(9.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
biwes-0.1.0-py3-none-any.whl
(11.0 kB
view details)
File details
Details for the file biwes-0.1.0.tar.gz.
File metadata
- Download URL: biwes-0.1.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
758ea88c7f0231fb6530f2494afafd2f324d0dd6485ba6d07e0936b6068c8921
|
|
| MD5 |
8d3da86171299906a84ce6d493924bdf
|
|
| BLAKE2b-256 |
3daa4e1aa47dc10f1aa3b8e187c103b12813b953ed9a5bb70a9b95e8e39fadb9
|
File details
Details for the file biwes-0.1.0-py3-none-any.whl.
File metadata
- Download URL: biwes-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e1cbc530377c40731471a560322cea12b6359d7d334fd2cd2d578cfec573048
|
|
| MD5 |
6ef7a71c27dda7950ceeefb3c920dc4c
|
|
| BLAKE2b-256 |
406358f9d286559ff34c07041df559493fcd21a220822ab1f07d0c52bb806b7b
|