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.1.3.tar.gz (14.7 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.3-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: parkol-0.1.3.tar.gz
  • Upload date:
  • Size: 14.7 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.3.tar.gz
Algorithm Hash digest
SHA256 d278c0afd8dbcde39d7f47664e912cc2727d8c48fc26e0762307751efb24ac26
MD5 d9573200fe1e1772f3044a606deab6dd
BLAKE2b-256 66c346fefa6557c5bb98f608794d652dbd3bf5389e9ad861846f3a88da4f4d33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parkol-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2d0d12b989a65f3f37a0af6920887d3fe16051fbb72ade2c068af5ce86037b3e
MD5 9ca584aa1a8718741a70768e27168492
BLAKE2b-256 235ee84c714aa42d9d47237459a69e16c892d08eb6347a0f80af802124ba9fb8

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