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 / edges
34 / 78
communities (SE-optimal)
6
1D structural entropy
4.634
2D structural entropy (optimal)
3.229
compression vs 1D
30.3%
encoding-tree entropy HT
2.486
Les Misérables
co-appearance of characters
nodes / edges
77 / 254
communities (SE-optimal)
13
1D structural entropy
5.336
2D structural entropy (optimal)
3.442
compression vs 1D
35.5%
encoding-tree entropy HT
2.629
Florentine families
Renaissance marriage ties
nodes / edges
15 / 20
communities (SE-optimal)
5
1D structural entropy
3.721
2D structural entropy (optimal)
2.437
compression vs 1D
34.5%
encoding-tree entropy HT
1.923
Caveman (4×6)
planted near-cliques
nodes / edges
24 / 60
communities (SE-optimal)
4
1D structural entropy
4.575
2D structural entropy (optimal)
2.709
compression vs 1D
40.8%
encoding-tree entropy HT
2.211
Petersen
vertex-transitive — no community structure
nodes / edges
10 / 15
communities (SE-optimal)
5
1D structural entropy
3.322
2D structural entropy (optimal)
2.548
compression vs 1D
23.3%
encoding-tree entropy HT
2.273
Balanced tree (b2,d4)
pure hierarchy
nodes / edges
31 / 30
communities (SE-optimal)
10
1D structural entropy
4.764
2D structural entropy (optimal)
2.424
compression vs 1D
49.1%
encoding-tree entropy HT
1.755
Grid 6×6
lattice — geometric layout kept; weak community structure
nodes / edges
36 / 60
communities (SE-optimal)
8
1D structural entropy
5.140
2D structural entropy (optimal)
3.263
compression vs 1D
36.5%
encoding-tree entropy HT
2.558
SBM 3-block
planted blocks (clean)
nodes / edges
150 / 1419
communities (SE-optimal)
6
1D structural entropy
7.200
2D structural entropy (optimal)
5.974
compression vs 1D
17.0%
encoding-tree entropy HT
5.029
LFR μ=0.2
LFR benchmark, easy regime
nodes / edges
150 / 1246
communities (SE-optimal)
7
1D structural entropy
7.166
2D structural entropy (optimal)
5.459
compression vs 1D
23.8%
encoding-tree entropy HT
4.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.