parkol 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- parkol-0.1.0/LICENSE +21 -0
- parkol-0.1.0/PKG-INFO +63 -0
- parkol-0.1.0/README.md +48 -0
- parkol-0.1.0/pyproject.toml +25 -0
- parkol-0.1.0/setup.cfg +4 -0
- parkol-0.1.0/src/parkol/__init__.py +11 -0
- parkol-0.1.0/src/parkol/cftp_bc20.py +797 -0
- parkol-0.1.0/src/parkol/cftp_huber.py +199 -0
- parkol-0.1.0/src/parkol/hybrid.py +223 -0
- parkol-0.1.0/src/parkol/prs.py +226 -0
- parkol-0.1.0/src/parkol/sample.py +115 -0
- parkol-0.1.0/src/parkol/utils.py +95 -0
- parkol-0.1.0/src/parkol.egg-info/PKG-INFO +63 -0
- parkol-0.1.0/src/parkol.egg-info/SOURCES.txt +16 -0
- parkol-0.1.0/src/parkol.egg-info/dependency_links.txt +1 -0
- parkol-0.1.0/src/parkol.egg-info/requires.txt +3 -0
- parkol-0.1.0/src/parkol.egg-info/top_level.txt +1 -0
- parkol-0.1.0/tests/test_sample.py +120 -0
parkol-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sarat Moka
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
parkol-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: parkol
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Exact uniform sampling of proper graph colourings via soft colouring and partial rejection sampling
|
|
5
|
+
Author-email: Sarat Moka <s.moka@unsw.edu.au>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/smoka-unsw/parkol
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: scipy
|
|
13
|
+
Requires-Dist: networkx
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# PaRKol
|
|
17
|
+
|
|
18
|
+
**Pa**rtial **R**ejection sampling for **K**-c**ol**ouring.
|
|
19
|
+
|
|
20
|
+
Exact uniform sampling of proper *k*-colourings of a graph, via the soft colouring framework.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install parkol
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import networkx as nx
|
|
32
|
+
from parkol import sample_coloring, verify_coloring
|
|
33
|
+
|
|
34
|
+
G = nx.petersen_graph()
|
|
35
|
+
colors = sample_coloring(G, k=5)
|
|
36
|
+
print(verify_coloring(G, colors)) # True
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Methods
|
|
40
|
+
|
|
41
|
+
| Method | Description | Condition |
|
|
42
|
+
|--------|-------------|-----------|
|
|
43
|
+
| `'hybrid'` | PRS + CFTP on components (default) | k > Δ |
|
|
44
|
+
| `'prs'` | Pure γ-PRS | k > Δ |
|
|
45
|
+
| `'cftp_huber'` | Huber (2004) bounding-chain CFTP | k > Δ |
|
|
46
|
+
| `'cftp_bc20'` | Bhandari & Chakraborty (2020) CFTP | k > 3Δ |
|
|
47
|
+
| `'nrs'` | Naive rejection sampling | k > Δ |
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
colors = sample_coloring(G, k=5, method='hybrid', seed=42)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Documentation
|
|
54
|
+
|
|
55
|
+
Full documentation: [https://parkol.readthedocs.io](https://parkol.readthedocs.io)
|
|
56
|
+
|
|
57
|
+
## Reference
|
|
58
|
+
|
|
59
|
+
S. Moka et al. (2026). *Near-Linear Time Perfect Sampling of Graph Colourings via Soft Colouring.* Preprint.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
parkol-0.1.0/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# PaRKol
|
|
2
|
+
|
|
3
|
+
**Pa**rtial **R**ejection sampling for **K**-c**ol**ouring.
|
|
4
|
+
|
|
5
|
+
Exact uniform sampling of proper *k*-colourings of a graph, via the soft colouring framework.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install parkol
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
import networkx as nx
|
|
17
|
+
from parkol import sample_coloring, verify_coloring
|
|
18
|
+
|
|
19
|
+
G = nx.petersen_graph()
|
|
20
|
+
colors = sample_coloring(G, k=5)
|
|
21
|
+
print(verify_coloring(G, colors)) # True
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Methods
|
|
25
|
+
|
|
26
|
+
| Method | Description | Condition |
|
|
27
|
+
|--------|-------------|-----------|
|
|
28
|
+
| `'hybrid'` | PRS + CFTP on components (default) | k > Δ |
|
|
29
|
+
| `'prs'` | Pure γ-PRS | k > Δ |
|
|
30
|
+
| `'cftp_huber'` | Huber (2004) bounding-chain CFTP | k > Δ |
|
|
31
|
+
| `'cftp_bc20'` | Bhandari & Chakraborty (2020) CFTP | k > 3Δ |
|
|
32
|
+
| `'nrs'` | Naive rejection sampling | k > Δ |
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
colors = sample_coloring(G, k=5, method='hybrid', seed=42)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
Full documentation: [https://parkol.readthedocs.io](https://parkol.readthedocs.io)
|
|
41
|
+
|
|
42
|
+
## Reference
|
|
43
|
+
|
|
44
|
+
S. Moka et al. (2026). *Near-Linear Time Perfect Sampling of Graph Colourings via Soft Colouring.* Preprint.
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "parkol"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Exact uniform sampling of proper graph colourings via soft colouring and partial rejection sampling"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Sarat Moka", email = "s.moka@unsw.edu.au"},
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"numpy",
|
|
17
|
+
"scipy",
|
|
18
|
+
"networkx",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/smoka-unsw/parkol"
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.packages.find]
|
|
25
|
+
where = ["src"]
|
parkol-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""
|
|
2
|
+
parkol -- Exact uniform sampling of proper graph colourings.
|
|
3
|
+
|
|
4
|
+
Uses gamma-soft colouring and partial rejection sampling (PRS).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .sample import sample_coloring
|
|
8
|
+
from .utils import verify_coloring
|
|
9
|
+
|
|
10
|
+
__version__ = "0.1.0"
|
|
11
|
+
__all__ = ["sample_coloring", "verify_coloring"]
|