Exact uniform sampling of proper graph colourings via soft colouring and partial rejection sampling
Project description
PaRKol
Partial Rejection sampling for K-colouring.
Exact uniform sampling of proper k-colourings of a graph, via the soft colouring framework.
Installation
pip install parkol
Quick Start
import networkx as nx
from parkol import sample_coloring, verify_coloring
G = nx.petersen_graph()
colors = sample_coloring(G, k=5)
print(verify_coloring(G, colors)) # True
Methods
| Method | Description | Condition |
|---|---|---|
'hybrid' |
PRS + CFTP on components (default) | k > Δ |
'prs' |
Pure γ-PRS | k > Δ |
'cftp_huber' |
Huber (2004) bounding-chain CFTP | k > Δ |
'cftp_bc20' |
Bhandari & Chakraborty (2020) CFTP | k > 3Δ |
'nrs' |
Naive rejection sampling | k > Δ |
colors = sample_coloring(G, k=5, method='hybrid', seed=42)
Documentation
Full documentation: https://parkol.readthedocs.io
Reference
S. Moka et al. (2026). Near-Linear Time Perfect Sampling of Graph Colourings via Soft Colouring. Preprint.
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file parkol-0.1.0.tar.gz.
File metadata
- Download URL: parkol-0.1.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0994b2e2deb3047f9917f58f5309811afa90e998f7cb6fc5bbbd2e9921502166
|
|
| MD5 |
2d05eab90ecc66e03fa80f9dd7f33074
|
|
| BLAKE2b-256 |
b5f51d2ddfca393ce65d72ec5984d4a5fb3774a02d95a2f9959a409c562f81d0
|
File details
Details for the file parkol-0.1.0-py3-none-any.whl.
File metadata
- Download URL: parkol-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5d304c172ee39edc873c511f6c600fa216e7d0424b141f9a0f32a05079a308a
|
|
| MD5 |
ce0e468ed53e8bd73747fd9eaa02e752
|
|
| BLAKE2b-256 |
4ec0cf1894cdf26c1ee7cd537e3f3bda48681d755eda1781121ce0fca9d04040
|