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.2.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.2-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: parkol-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 98869449d6c198977a247021673bda24affcc606b999d08babf65f6bebd2a1e0
MD5 ebff665afc04c153fa4d948943b1200a
BLAKE2b-256 25d0285237678fa830d2edc17a1cb963ec9fb28d4296be78679576e2964ad185

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parkol-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 122acec5fb3be29cb78357fe6d0900be393f44e912be9eb14c8734f00c7aa3ac
MD5 41938f1e7678a76e662734daf0cbdd8f
BLAKE2b-256 7225c98a0f920a26d332518b9a528d0bb2ceae14d95025d021e8587124d8d318

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