5D Library › 百卷知识超图拓扑、多模态个人先验编译与自主知识帝国标度律 · English
第四章 作为超图的书库:度数、共用与相连的卷
为什么是超图
图连接的是成对的点;一卷书同时连接好几个原语,所以书库的自然结构是超图,其边可以包含任意多个节点 (Berge 1973)。原语是节点,每一卷是一条超边。p08 用这种语言描述第三章的合成书库。
推导
# 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 59平均每条超边连接 3.44 个原语。度数极不均衡:最常用的三个原语分别出现在 65、41 与 34 卷中,中位数原语只出现在 6 卷中,另有八个只用过一次。共用图把被同一卷同时用到的两个原语连起来,其密度是 0.376。s-线图显示各卷如何通过共用原语相连:共用一个原语时,3,620 对卷连成一个整体;共用两个时,仍有 99 卷经由 1,269 对相连;共用三个时,书库分裂成 41 个连通分量,最大的有 59 卷。
对读者而言,这有一个实际意义:几乎每一卷与几乎其他每一卷之间,都只隔着两个共用原语,所以任何两卷之间都能搭出一条阅读路径;但只有大约一半的书库构成一个紧密相连的核心,其中相邻的卷共用三个原语。
小结
作为超图,合成书库有少数枢纽原语、一条罕见原语的长尾、在共用一两个原语层面上紧密相连的主体,以及在三个原语层面上的碎片化结构。这些数字描述的是合成的关联结构;同一个程序可以在第三章提议的真实标注上运行。
参考文献
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).