What does Community Topology Checkup conclude, in numbers, about “Distance Comes Before Topology: Jaccard Distance, the Gap Between Classes and the Stability of Barcodes”?
Answer: Barcodes stand on a distance, and the distance must pass inspection first. This book uses only the table of which posts each member took part in, without counts, text or identities. The median Jaccard distance between boosting accounts is 0.152, the median distance from a genuine member to her nearest neighbour is 0.472, and between the two classes lies only the narrow gap from 0.333 to 0.344. The stability theorem guarantees that when each distance moves by ε, zero-dimensional bars move by at most ε and L3 by at most 6ε. Switching to the cosine distance changes the AUC of L3 from 0.983 to 0.980, hardly at all, but the zero-dimensional alarm line must be reset. The next question is how long a one-dimensional bar must be to count as more than noise. Without something to compare with, "long" means nothing; Chapter 4 supplies the comparison with a permutation null model.
Scope of the numbers: Every community and member in the book is synthetic data with fixed seeds, and no data from any real community or person is used; all calculations are generated by its programs, and its parameters are illustrative. The book is not individual business advice, and its "detection of paid boosters" produces only a list of suspects for human review, never an automatic penalty for any member.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.152, 0.333, 0.344, 0.472
| class | pairs | Jaccard min/med/max | cosine min/med/max |
|---|---|---|---|
| sock-sock pairs | 153 | 0.000 0.152 0.333 | 0.000 0.082 0.200 |
| real-sock pairs | 216 | 0.788 0.865 0.956 | 0.651 0.762 0.915 |
| real nearest neighbour | 30 | 0.344 0.472 0.629 | 0.207 0.309 0.441 |
| all real-real pairs | 435 | 0.344 0.927 1.000 | 0.207 0.864 1.000 |
| gap between classes (Jaccard): 0.333 to 0.344 |
Show the full program
# Chapter 3. p31: How far apart are lockstep accounts and real neighbours?
# One padded community (12 real members, 18 lockstep accounts) and one
# genuine community (30 members), fixed seed, synthetic only. Two
# distances on liked-post sets: Jaccard 1 - |A&B|/|A|B| and the cosine
# distance of 0/1 vectors 1 - |A&B|/sqrt(|A||B|). For real members we
# report each one's nearest neighbour, since rings are built from those.
import math
import random
T, P = 24, 5 # 24 topics on a ring, 5 posts each (illustrative)
N_POSTS = T * P
def member(rng, centre, width, q=0.8, stray=0.03):
# a genuine member likes posts on an arc of topics around centre
s = set()
for t in range(T):
dd = abs(t - centre) % T
dd = min(dd, T - dd)
hit = q if dd <= width / 2.0 else stray
for k in range(P):
if rng.random() < hit:
s.add(t * P + k)
return s
def sock(rng, target, q=0.95, stray=0.01):
# a boosting account likes the operator's target posts in lockstep
s = set()
for p in range(N_POSTS):
if rng.random() < (q if p in target else stray):
s.add(p)
return s
def community(rng, n_real, arc, n_sock):
# n_real genuine members with interest centres on [0, arc) topics,
# plus n_sock boosting accounts aimed at 30 target posts
pts = []
for _ in range(n_real):
pts.append(member(rng, rng.uniform(0, arc), rng.randint(5, 8)))
target = set(rng.sample(range(N_POSTS), 30))
for _ in range(n_sock):
pts.append(sock(rng, target))
return pts
def jaccard(a, b):
u = len(a | b)
return 1.0 - len(a & b) / u if u else 0.0
def barcodes(pts, cap=1.0):
return barcodes_d(len(pts), lambda i, j: jaccard(pts[i], pts[j]), cap)
def barcodes_d(n, dist, cap=1.0):
# Vietoris-Rips filtration (up to triangles) of a distance dist(i, j).
# H0 by union-find; H1 by mod-2 reduction of triangle columns,
# each column stored as a Python integer used as a bitset of edges.
edges = []
for i in range(n):
for j in range(i + 1, n):
d = dist(i, j)
if d <= cap:
edges.append((d, i, j))
edges.sort()
eid = {(i, j): k for k, (d, i, j) in enumerate(edges)}
par = list(range(n))
def find(x):
while par[x] != x:
par[x] = par[par[x]]
x = par[x]
return x
h0, neg = [], set()
for k, (d, i, j) in enumerate(edges):
a, b = find(i), find(j)
if a != b:
par[max(a, b)] = min(a, b)
h0.append((d, i, j))
neg.add(k)
tris = []
for (i, j), e in eid.items():
for k in range(j + 1, n):
f, g = eid.get((i, k)), eid.get((j, k))
if f is not None and g is not None:
tris.append(tuple(sorted((e, f, g), reverse=True)))
tris.sort()
piv, h1 = {}, []
for t in tris:
col = (1 << t[0]) | (1 << t[1]) | (1 << t[2])
while col:
low = col.bit_length() - 1
if low not in piv:
piv[low] = col
break
col ^= piv[low]
if col and edges[t[0]][0] > edges[low][0]:
h1.append((edges[low][0], edges[t[0]][0]))
for k in range(len(edges)):
if k not in neg and k not in piv:
h1.append((edges[k][0], cap)) # still open at the cap
return h0, h1
def cosine(a, b):
return 1.0 - len(a & b) / math.sqrt(len(a) * len(b))
def q3(vals):
v = sorted(vals)
return v[0], v[len(v) // 2], v[-1]
rng = random.Random(20261113)
gen = community(rng, 30, 24, 0)
pad = community(rng, 12, 24, 18)
classes = []
ss = [(pad[i], pad[j]) for i in range(12, 30) for j in range(i + 1, 30)]
classes.append(("sock-sock pairs", ss))
rs = [(pad[i], pad[j]) for i in range(12) for j in range(12, 30)]
classes.append(("real-sock pairs", rs))
nn = []
for i in range(30):
j = min((k for k in range(30) if k != i),
key=lambda k: (jaccard(gen[i], gen[k]), k))
nn.append((gen[i], gen[j]))
classes.append(("real nearest neighbour", nn))
far = [(gen[i], gen[j]) for i in range(30) for j in range(i + 1, 30)]
classes.append(("all real-real pairs", far))
print("%-24s %5s %-20s %-20s" % ("class", "pairs", "Jaccard min/med/max",
"cosine min/med/max"))
for name, prs in classes:
j3 = q3([jaccard(a, b) for a, b in prs])
c3 = q3([cosine(a, b) for a, b in prs])
print("%-24s %5d %.3f %.3f %.3f %.3f %.3f %.3f"
% ((name, len(prs)) + j3 + c3))
lo = max(jaccard(a, b) for a, b in ss)
hi = min(jaccard(a, b) for a, b in nn)
print("gap between classes (Jaccard): %.3f to %.3f" % (lo, hi))Single source and citation
Fan, Y. (2026). Persistent Homology and Betti Numbers: Structural Voids in High-Net-Worth Private Communities and the Review of Fake Cliques (Version 1.0.0), Chapter 3: Distance Comes Before Topology: Jaccard Distance, the Gap Between Classes and the Stability of Barcodes. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-236 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026236,
author = {Fan, Yafu},
title = {Persistent Homology and Betti Numbers: Structural Voids in High-Net-Worth Private Communities and the Review of Fake Cliques},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Activity Is Not a Loop: Triangle Closure, Transitivity and Blocks of Mutual Boosting
- Chapter 2 · Persistent Homology: the Rips Filtration, Union-Find for Dimension Zero and Reduction Mod 2 for Dimension One
- Chapter 4 · How Long Is Long: a Permutation Null Model, an Alarm Line and the Dose-Response of Community Size
- Chapter 5 · The Review List: Short Zero-Dimensional Bars, Camouflage and Base Rates
- Chapter 6 · The Monthly Checkup: a Barcode Time Series of Hollowing, and the Cost of Computation
- Chapter 7 · Eastern and Western Classics Examined: "Broad, Not Partisan" and Euler's Polyhedron Formula
- Chapter 8 · Closing the Empirical Loop: the Community Topology Checkup, Human Review and a Pre-Registered Test