What does Lazy Tool Hubs conclude, in numbers, about “The Branching Factor: Depth against Width, and Hanging Popular Tools on the Root”?
Answer: Chapter 4 treats depth against width and hanging on the root any tool called in a session with probability above 0.862.
Scope of the numbers: Selection accuracy lacks reliable peer-reviewed primary evidence and is demoted to an author's hypothesis. Marked boxes separate published evidence, runnable Python calculations (17 programs), classical sources and the author's hypotheses.
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.862
| pinned | P(call) of last | hops/call | cost W=0 | cost W=300 |
| 0 | 0.000 | 2.207 | 8558.5 | 16504.5 |
| 1 | 0.875 | 1.988 | 8510.7 | 15669.1 |
| 2 | 0.630 | 1.859 | 8605.4 | 15296.6 |
| 3 | 0.480 | 1.760 | 8787.8 | 15124.4 |
| 5 | 0.322 | 1.609 | 9298.4 | 15089.6 |
| 8 | 0.214 | 1.456 | 10264.2 | 15507.5 |
| 12 | 0.148 | 1.316 | 11743.6 | 16481.7 |
| 20 | 0.091 | 1.129 | 15011.6 | 19077.5 |
| 40 | 0.047 | 0.856 | 23905.0 | 26985.7 |
| pin threshold C / (HOP + C) = 0.862 |
Show the full program
# Chapter 4. p42: pin the hottest tools at the root, route the rest.
# The m most called tools keep their full schemas (C tokens each) in
# context from the start and are called in zero routing hops; the other
# N - m sit in an 8-ary Huffman tree as in p11. Session cost counts
# tokens plus W token-equivalents per routing hop (latency priced as
# context; W = 0 ignores latency). N = 300, Zipf(1), M = 12 calls; all
# parameters illustrative. Rule of thumb: pin tool i when the chance it
# is called in a session exceeds C / (HOP + C).
import heapq
import math
N, C, S, HOP, M, K = 300, 500, 25, 80, 12, 8
def zipf(n, a):
w = [1.0 / (i ** a) for i in range(1, n + 1)]
t = math.fsum(w)
return [x / t for x in w]
def huffman(p, idx, k):
items = [(p[i], i, i) for i in idx]
seq, pad = N, 0
while (len(items) + pad - 1) % (k - 1):
pad += 1
for _ in range(pad):
items.append((0.0, seq, None))
seq += 1
heapq.heapify(items)
while len(items) > 1:
kids = [heapq.heappop(items) for _ in range(min(k, len(items)))]
node = tuple(c[2] for c in kids if c[2] is not None)
heapq.heappush(items, (math.fsum(c[0] for c in kids), seq, node))
seq += 1
return items[0][2]
def walk(t, p, d, inner, depth):
if isinstance(t, int):
depth[t] = d
return p[t]
m = math.fsum(walk(c, p, d + 1, inner, depth) for c in t)
inner.append((m, len(t), d))
return m
def cost(p, m, w):
inner, depth = [], {}
walk(huffman(p, range(m, N), K), p, 0, inner, depth)
terms = [m * C]
for mass, k, d in inner:
if d == 0:
terms.append(k * S)
else:
terms.append((1.0 - (1.0 - mass) ** M) * (HOP + k * S))
for i in range(m, N):
terms.append((1.0 - (1.0 - p[i]) ** M) * (HOP + C))
hops = math.fsum(p[i] * depth[i] for i in range(m, N))
return math.fsum(terms) + w * M * hops, hops
p = zipf(N, 1.0)
print(" pinned P(call) of last hops/call cost W=0 cost W=300")
for m in (0, 1, 2, 3, 5, 8, 12, 20, 40):
c0, hops = cost(p, m, 0)
c3, _ = cost(p, m, 300)
last = 1.0 - (1.0 - p[m - 1]) ** M if m else 0.0
print("%6d %14.3f %10.3f %10.1f %11.1f" % (m, last, hops, c0, c3))
print("pin threshold C / (HOP + C) = %.3f" % (C / (HOP + C)))Single source and citation
Fan, Y. (2026). A Lazy-Loading Private Tool Hub: Near-Zero Opening Context for Hundreds of Checkers and On-Demand Routing Trees (Version 1.0.0), Chapter 4: The Branching Factor: Depth against Width, and Hanging Popular Tools on the Root. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-257 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026257,
author = {Fan, Yafu},
title = {A Lazy-Loading Private Tool Hub: Near-Zero Opening Context for Hundreds of Checkers and On-Demand Routing Trees},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · The Linear Bill: Context Cost of Loading Everything and the Entropy Bound
- Chapter 2 · Building Huffman Trees: Many-Way Merging, Dummy Leaves and the Price of a Menu
- Chapter 3 · Navigable Trees: the Price of Alphabetic Order and the Accumulation of Wrong Turns
- Chapter 5 · Queueing with Cold Starts: the Delay Bill of Lazy Loading and How Long to Stay Warm
- Chapter 6 · Frequency Drift: the Cost of Wrong Frequencies and When to Rebuild the Routing Tree
- Chapter 7 · Classical Sources East and West: Offices and Duties in the Rites of Zhou and Dewey's Decimal Scheme
- Chapter 8 · Closing the Loop: a Monthly Report on Catalogue Layering and Call Frequency