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

pinnedP(call) of lasthops/callcost W=0cost W=300
00.0002.2078558.516504.5
10.8751.9888510.715669.1
20.6301.8598605.415296.6
30.4801.7608787.815124.4
50.3221.6099298.415089.6
80.2141.45610264.215507.5
120.1481.31611743.616481.7
200.0911.12915011.619077.5
400.0470.85623905.026985.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