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.0

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.0
File Size Uploaded
graphkind_wl-0.1.0.tar.gz 7.0 kB Details

Built distribution (wheel)

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

Total release size: 13.5 kB

Release files / graphkind_wl-0.1.0.tar.gz

Download URL graphkind_wl-0.1.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f1cfd4c0ed63fb43dcaaa21c113f590bd89dd79148c4c4d3010a266ef75044eb
BLAKE2b-256 checksum
How to use checksums
012149f53f541a81347c47b2b85a2cb492fca66ecdd1ce719c158b2be5111302
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.0-py3-none-any.whl

Download URL graphkind_wl-0.1.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fdd16c5bc5153e71b9b8755c08fad5fd5d20454c4c1435989ba5926052065a7
BLAKE2b-256 checksum
How to use checksums
f90c2cd6f92d8dc742a4ee0fc1cfdb24d30a490f05ba9add8b57fd344d2f04d8
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

0.1.1

2 release files

This release

0.1.0 This release

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