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 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

parkol-0.1.1.tar.gz (14.6 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.1.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for parkol-0.1.1.tar.gz
Algorithm Hash digest
SHA256 03a763b0ff28a3242880c723bf8d7451c4fb1fd6ed82dbedf651023ace6e09b7
MD5 6d692aa315a1140b435edb04d9e6ce48
BLAKE2b-256 a52092b5ee6992208aace566098c45e0d669d9198f2396ceddfd58dc8fdd8b8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parkol-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e4e702dd62f85d9d6bccb676504c69828f532403aef205015319d389f6ba811
MD5 70ad669e64fcb9589ea01dc21f2d0b41
BLAKE2b-256 8a491fef2a5b75fb8834e3e09ea4e483bd0f247496eacad0485f5ea5e6d9ea33

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