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.1.tar.gz (15.3 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.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for parkol-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2210fd40e2eb85b4faa0736c7e209db3a3aaf5631abe0253106a680cd2f8a90c
MD5 61543fe9d32abf18c81a592ab891d319
BLAKE2b-256 062f3ccce7d1ccee8ad52389fd1c26bc4ba383f2a969f0ddc578dc6f6f1e2ff8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for parkol-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d668a34f97ad9895b5a14c837b404932389e0afffff0d7e65cb1da9a4ee3d1da
MD5 419cad944f2272db632ef97471d60e66
BLAKE2b-256 37ea9933d921f695f8cf46a6249b6f2c4ea5cdcc22a61a10bae811b7616b852e

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