Skip to main content

graphkind-wl

Color refinement (1-WL) and correlated k-FWL (equivalent to (k+1)-WL) over adjacency bitmasks: partitions, separation tests and T4 (complement invariance). The kernel of the GraphKind laboratory.

Install

pip install graphkind-wl

No dependencies (standard library only). Python ≥ 3.9.

Quickstart

from graphkind_wl import adj_from_edges, separa, t4, wl1_colors, perfil

# C6 and two triangles: the classic 1-WL collision
c6  = adj_from_edges(6, [(i, (i + 1) % 6) for i in range(6)])
dos = adj_from_edges(6, [(0, 1), (1, 2), (2, 0), (3, 4), (4, 5), (5, 3)])

separa(c6, dos, 1)   # False  (1-WL collides)
separa(c6, dos, 2)   # True   (2-FWL = 3-WL separates)

perfil(wl1_colors(6, c6))   # (6,)  — one class
t4(c6)                      # True  — the partition survives complement

The anchors (from the frozen results)

pair 1-WL k=2 (3-WL) k=3 (4-WL)
C6 vs 2·C3 collides separates separates
Petersen vs pentagonal prism collides separates separates
Rook vs Shrikhande (SRG(16,6,2,2)) collides collides separates

The last row is the boundary: the standard 3-WL does not separate the cospectral pair; the correlated 3-FWL (≡ 4-WL) does. All three rows are asserted in tests/test_kernel.py against the laboratory's freezes.

API

function what it does
adj_from_edges(n, edges) adjacency bitmasks from an edge list
edges_from_adj(adj) edge list from bitmasks
complement(n, adj) simple complement (no loops)
wl1_colors(n, adj, rounds=None) 1-WL colors per vertex
kfwl_colors(n, adj, k, rounds=None) k-FWL colors per k-tuple (k>=2)
separa(adj1, adj2, k) does the observer separate the pair? (union test)
particion(colors) canonical partition (class index by first appearance)
perfil(colors) multiset of class sizes (the WL profile)
t4(adj) is the 1-WL partition complement-invariant? (theorem T4)

What is T4

The partition induced by color refinement is invariant under complement: G and Ḡ reach the same partition at every round — the color labels are arbitrary hashes and may differ. The theorem was proposed and verified by the GraphKind engine, with a written proof; its price (6 168 fused pairs at n≤8) and its incompatibility with completeness are measured in the paper.

License

CC-BY-4.0 — cite the DOI above.

Metadata

Release files for graphkind-wl 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphkind-wl 0.1.1
File Size Uploaded
graphkind_wl-0.1.1.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for graphkind-wl 0.1.1
File Interpreter ABI Platform
graphkind_wl-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / graphkind_wl-0.1.1.tar.gz

Download URL graphkind_wl-0.1.1.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e0705b6bd3b8355d8958e9c117dfd70ba361cf17f88a98ec392b988b8501cf6e
BLAKE2b-256 checksum
How to use checksums
83a3b9bf6e0e0bc8536b6d4c85d07c2ba0014ca4d37612f8055861e169e59d66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / graphkind_wl-0.1.1-py3-none-any.whl

Download URL graphkind_wl-0.1.1-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e635d437bd853ee971ff4a436645d179d8c1f06dfe096bf70f2a96d9d2769826
BLAKE2b-256 checksum
How to use checksums
37a0b465162c845d3aea4c72d3ccc7e9acc856c39c46e43cf278359c676074e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page