Gallery: optimal structural-entropy partitions

The SE-optimal flat partition (minimizing 2D structural entropy at free k, via selib.optimal_2d) on classical graphs. Node colour = community. ← benchmark · SE tutorial · repo

Each graph is partitioned by minimizing its structural entropy — no target number of clusters is given; the resolution is chosen by the objective. The calculator behind these numbers:

import selib, networkx as nx
G = nx.karate_club_graph()
selib.se_report(G)
# {'n': 34, 'm': 78, 'se_1d': ..., 'se_2d_optimal': ..., 'num_communities': ..., ...}
labels, h2 = selib.optimal_2d(G)        # SE-optimal partition + its 2D-SE
selib.structural_entropy(G, labels)     # 2D-SE of any partition
selib.structural_entropy(G, dim=1)      # 1D-SE (partition-free upper bound)

Karate club

Zachary 1977 — the canonical split
nodes / edges34 / 78
communities (SE-optimal)6
1D structural entropy4.634
2D structural entropy (optimal)3.229
compression vs 1D30.3%
encoding-tree entropy HT2.486

Les Misérables

co-appearance of characters
nodes / edges77 / 254
communities (SE-optimal)13
1D structural entropy5.336
2D structural entropy (optimal)3.442
compression vs 1D35.5%
encoding-tree entropy HT2.629

Florentine families

Renaissance marriage ties
nodes / edges15 / 20
communities (SE-optimal)5
1D structural entropy3.721
2D structural entropy (optimal)2.437
compression vs 1D34.5%
encoding-tree entropy HT1.923

Caveman (4×6)

planted near-cliques
nodes / edges24 / 60
communities (SE-optimal)4
1D structural entropy4.575
2D structural entropy (optimal)2.709
compression vs 1D40.8%
encoding-tree entropy HT2.211

Petersen

vertex-transitive — no community structure
nodes / edges10 / 15
communities (SE-optimal)5
1D structural entropy3.322
2D structural entropy (optimal)2.548
compression vs 1D23.3%
encoding-tree entropy HT2.273

Balanced tree (b2,d4)

pure hierarchy
nodes / edges31 / 30
communities (SE-optimal)10
1D structural entropy4.764
2D structural entropy (optimal)2.424
compression vs 1D49.1%
encoding-tree entropy HT1.755

Grid 6×6

lattice — geometric layout kept; weak community structure
nodes / edges36 / 60
communities (SE-optimal)8
1D structural entropy5.140
2D structural entropy (optimal)3.263
compression vs 1D36.5%
encoding-tree entropy HT2.558

SBM 3-block

planted blocks (clean)
nodes / edges150 / 1419
communities (SE-optimal)6
1D structural entropy7.200
2D structural entropy (optimal)5.974
compression vs 1D17.0%
encoding-tree entropy HT5.029

LFR μ=0.2

LFR benchmark, easy regime
nodes / edges150 / 1246
communities (SE-optimal)7
1D structural entropy7.166
2D structural entropy (optimal)5.459
compression vs 1D23.8%
encoding-tree entropy HT4.689
Read this gallery as: a graph with strong community structure (Karate, SBM, caveman, LFR) compresses well — its optimal 2D entropy sits far below the partition-free 1D value — while a structureless graph (Petersen, grid) barely compresses, and a pure tree is best described hierarchically. Every value is computed by selib.calc from the graph; nothing is hand-set.