Skip to main content

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.

To our knowledge, PaRKol is the first Python package implementing near-linear time exact uniform sampling of graph colourings via soft colouring and partial rejection sampling.

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 and A. Vahedi (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

parkol-0.2.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parkol-0.2.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file parkol-0.2.0.tar.gz.

File metadata

  • Download URL: parkol-0.2.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for parkol-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d98233089a77d5916f46f395d1b41827a9d2861e9bced1bed09d18e1ba511767
MD5 68642c4ffd9f7546444436c34441996e
BLAKE2b-256 3e62dbc7d0e0322e3f277003b97e0292f0adc8939507360514fb68ac3d89630c

See more details on using hashes here.

File details

Details for the file parkol-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: parkol-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for parkol-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 290e37abc8bee6cf3c1cc9eb9a90b2abbdf81be45e2b1158aa3aa10e2697a29a
MD5 92fd3037578cae602aac83b957d295bb
BLAKE2b-256 eeb3331c9e55da417008a58844029672049bdf1e60f15a1deed4ba0765ff8990

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page