5D Library › Hundred-Volume Knowledge Hypergraphs, Multimodal Personal Prior Compilation and Autonomous Empire Scaling · 中文
Chapter 4. The Library as a Hypergraph: Degrees, Co-Use and Connected Volumes
Why a hypergraph
A graph joins pairs; a volume joins several primitives at once, so the natural structure of the library is a hypergraph, whose edges may contain any number of nodes (Berge 1973). Primitives are the nodes and each volume is a hyperedge. p08 describes the synthetic library of Chapter 3 in these terms.
Calculation
# Chapter 4. p08: The library as a hypergraph: primitives are nodes,
# each volume is a hyperedge joining the primitives it uses (synthetic
# incidence of p06, same seed). Reported: hyperedge sizes, node
# degrees, the co-use graph (two primitives joined if some volume uses
# both), and the s-line graph of volumes (two volumes joined if they
# share at least s primitives): number of components and the largest.
import random
def incidence(rng):
w = [1 / (j + 1) ** 0.8 for j in range(15)]
vols = []
for _ in range(100):
k = rng.choice((2, 2, 3, 3, 3, 4, 4, 5))
use = set()
while len(use) < k:
use.add(rng.choices(range(15), weights=w)[0])
use = sorted(use)
if rng.random() < 0.25:
use.append(15 + rng.randrange(30))
vols.append(use)
return vols
def components(n, edges):
parent = list(range(n))
def find(x):
while parent[x] != x:
parent[x] = parent[parent[x]]
x = parent[x]
return x
for a, b in edges:
parent[find(a)] = find(b)
sizes = {}
for x in range(n):
sizes[find(x)] = sizes.get(find(x), 0) + 1
return len(sizes), max(sizes.values())
if __name__ == "__main__":
vols = incidence(random.Random(100))
sizes = [len(v) for v in vols]
nodes = sorted({j for v in vols for j in v})
deg = sorted((sum(j in v for v in vols) for j in nodes), reverse=True)
print(" volumes {}, primitives used {}, mean hyperedge size {:.2f}"
.format(len(vols), len(nodes), sum(sizes) / len(sizes)))
print(" node degrees: top three {}, median {}, used once {}".format(
deg[:3], deg[len(deg) // 2], sum(d == 1 for d in deg)))
pairs = {(a, b) for v in vols for a in v for b in v if a < b}
n = len(nodes)
print(" co-use graph: {} links of {} possible, density {:.3f}".format(
len(pairs), n * (n - 1) // 2, len(pairs) / (n * (n - 1) / 2)))
for s in (1, 2, 3):
e = [(i, k) for i in range(100) for k in range(i + 1, 100)
if len(set(vols[i]) & set(vols[k])) >= s]
c, big = components(100, e)
print(" s = {}: {:5,d} volume pairs, {:3d} components, largest {}"
.format(s, len(e), c, big))
# volumes 100, primitives used 28, mean hyperedge size 3.44
# node degrees: top three [65, 41, 34], median 6, used once 8
# co-use graph: 142 links of 378 possible, density 0.376
# s = 1: 3,620 volume pairs, 1 components, largest 100
# s = 2: 1,269 volume pairs, 2 components, largest 99
# s = 3: 192 volume pairs, 41 components, largest 59The mean hyperedge joins 3.44 primitives. Degrees are very unequal: the top three primitives appear in 65, 41 and 34 volumes, the median one in 6, and eight are used once. The co-use graph, which joins two primitives if some volume uses both, has a density of 0.376. The s-line graph shows how volumes connect through shared primitives: sharing one primitive links 3,620 pairs of volumes into a single component; sharing two still leaves 99 volumes connected through 1,269 pairs; sharing three breaks the library into 41 components, the largest with 59 volumes.
For a reader this has a practical meaning: almost every volume is two shared primitives away from almost every other, so a reading path can be built through any two volumes; but only about half of the library forms a tightly linked core in which neighbouring volumes share three primitives.
Summary
As a hypergraph, the synthetic library has a few hub primitives, a long tail of rare ones, a densely connected body at the level of one or two shared primitives and a fragmented structure at three. These numbers describe a synthetic incidence; the same program can be run on the real tagging proposed in Chapter 3.
References
Fan, Y. (2026). Hundred-Volume Knowledge Hypergraphs, Multimodal Personal Prior Compilation and Autonomous Empire Scaling: Cross-Disciplinary Isomorphisms, Zero-Marginal-Cost Replication and Century-Scale Knowledge Preservation [百卷知识超图拓扑、多模态个人先验编译与自主知识帝国标度律] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090260 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).