# Spectra and Communities Author: Bee Rosa Davis Source: https://www.davisgeometric.com/gigi/gigi-builds/exercises/ch09.html Collection: GIGI Builds Status: Public lesson. Text edition of the public page, with links, equations, figure descriptions and expanded details. Interactive readouts describe the initial displayed state, not every possible input. Use the linked interactive page and its evidence files for other states. Publication here does not change the source’s research status, assumptions or limitations. --- [Chapters](https://www.davisgeometric.com/gigi/gigi-builds/index.html#builds) · Chapter 9 # Spectra and Communities Part III — The Signals That Run While You Sleep · seven builds, seven receipts The chapter's exercises are about putting your ear to four very different rooms and confirming the engine prints the chord you hear — early-exit zeros, closed-form cliques, bipartite ceilings, expanders that refuse to fork, and the Lanczos tab the connected case pays. Every receipt below is one you can pin against a `BLD-CH9-*` number I shipped, or against a `src/spectral.rs` line range I gave you. Run it live — GQL console Point at the public read-only instance (no key needed) or your own engine (start it with `GIGI_CORS_ORIGIN=*` for browser access — dev only). SHOW BUNDLES; ``` — ``` ## E9.1 Reproduce the four-room gap quartet Build A harness that constructs the four bundles behind `BLD-CH9-GAP-DISCONNECTED`, `-CLIQUE`, `-WITHIN-CLUSTER`, and `-EXPANDER`, calls `spectral_gap` at `src/spectral.rs:315` on each, and prints the four scalars side by side. Receipt Bit-exact matches: `0.0000000000`, `1.0344827586`, `2.0000000000`, `0.3071210168` — the last printed digit in all four cases, checked against `30.0/29.0` for the clique by equality, not tolerance. Bonus Add a fifth row: 30 records with *two* components — one clique of 20 and one clique of 10, no shared index. The gap should still print `0.0000000000`, and the union-find at `src/spectral.rs:211` should fire before any Laplacian assembles. done ## E9.2 Instrument the union-find early-exit Build Wrap `components_from_index` at `src/spectral.rs:211` with a tracing span and a counter for *Laplacian-was-assembled* vs *returned-zero-before-linear-algebra*. Run the disconnected receipt and the expander receipt through it. Receipt A log line proving the disconnected case returns `0.0` without ever calling `field_index_graph` at `src/spectral.rs:280`, plus a wall-clock under five microseconds on \(n=30\) — the early-exit row of `BLD-CH9-TIMING` says `3{,}000 ns` on \(n=10\), so \(n=30\) should still be deep in the BFS-only regime. Bonus Force a disconnected bundle of \(n=10{,}000\) in 100 components and confirm the timing stays in microseconds — the early-exit is supposed to scale on \(\alpha(n)\), not on the eigensolver. done ## E9.3 Benchmark the Lanczos tab against my timing receipt Build A criterion-style benchmark that runs `spectral_gap` on connected non-trivial bundles at \(n \in \{10, 100, 1000, 3000\}\) and prints ns and \(\mu\)s per record. Receipt The \(n=100\) and \(n=1000\) rows land within \(\pm 20\%\) of `BLD-CH9-TIMING`: `6{,}677{,}600 ns` and `601{,}430{,}600 ns`, respectively. The \(n=3000\) row extrapolates roughly linearly per record into the \(\sim 600\,\mu\text{s}\) band the honesty receipt warns about. Bonus Drop the per-record cost into a Prometheus gauge against the sharded endpoint at `gigi_stream.rs:14504-14506`, then watch what happens when you run the sweep against a near-bipartite bundle where the gap is close to \(2.0\) — iteration count rises with the gap's inverse, and the meter should show it. done ## E9.4 Stress the expander honesty contract Build Generate a sweep of coprime-tag expanders — \((7, 11)\), \((11, 13)\), \((13, 17)\), \((17, 19)\) — each over \(n \in \{30, 50, 100\}\), and record the gap and the Fiedler-vector sign-distribution histogram for each. Receipt For \((7,11)\) at \(n=50\), the gap reproduces `BLD-CH9-GAP-EXPANDER` at `0.3071210168` bit-for-bit, and every other sweep shows a Fiedler-vector sign distribution that does *not* bimodally split — visual proof that \(\lambda_1\) is a measurement of mixing, not a partition. Bonus Re-run with one tag-pair deliberately non-coprime, e.g.\ \((6, 9)\). The mixing breaks down; the Fiedler vector now actually picks a side; the same scalar means a different thing. Show the histogram delta in one figure. done ## E9.5 Forge the bipartite ceiling and refuse to exceed it Build Construct a sequence of 10-record bundles indexed on (band, sector) and on synthetic two-coloring indexes, run them through `spectral_gap`, and assert in a test that the returned value is always \(\le 2.0\) and equals \(2.0\) exactly on a clean bipartite shape. Receipt A passing test named `spectral_gap_respects_bipartite_ceiling` that pins `BLD-CH9-GAP-WITHIN-CLUSTER`'s `2.0000000000` on the clean case and an assertion failure if any synthetic bundle ever returns \(> 2.0\). Bonus Add a near-bipartite perturbation — one extra edge inside one of the two halves — and watch the gap fall from \(2.0\) to \(2.0 - \epsilon\). Print the perturbation size against \(\epsilon\) and fit a slope. done ## E9.6 Wire Ollivier–Ricci against the clusters receipt Build Reconstruct the 12-chart / 3-cluster Atlas from `BLD-CH9-RICCI-CLUSTERS` (granularity \(0.4\), \(\tau = 5.0\)), call `Atlas::ricci` at `src/coherence.rs:469`, and dump \((d, W_1, \kappa)\) for all three cluster pairs. Receipt A printout matching \(\kappa(0,1) = \kappa(0,2) = 0.6666666667\) and \(\kappa(1,2) = 0.5285954792\) with \(W_1\) and \(d\) as printed in the chapter, then a sign-test assertion: no \(\kappa\) in the clusters-only Atlas is negative, because the geometry contains no bridge edge. Bonus Inject a bridging chart between clusters 1 and 2 and re-run. The bridge edge should produce a negative \(\kappa\) — the case `tdd_ricci_3_negative_bridge` at `src/coherence.rs:853` pins. Confirm the bridge's \(\kappa < 0\) and report the value. done ## E9.7 Replay the brain-catalog refusal on a disconnected sample Build Hit the sharded `spectral_gap` endpoint at `gigi_stream.rs:14504-14506` with a bundle structured like `BLD-CH9-GAP-DISCONNECTED` (3 clusters of 10 on `cluster_id`), then have a small `CONFIDENCE`-shaped consumer route on the returned \(\lambda_1\). Receipt The endpoint returns `0.0000000000`; the consumer refuses to emit a single confidence score over three disjoint worlds and instead returns a per-component verdict. A log line names the refusal as the red gate — not a missing value, a verdict. Bonus Repeat against the clique receipt and the expander receipt and show three distinct consumer paths from one scalar: clique routes through “one episode, many witnesses”; expander routes through “connected, no preferred cut”; disconnected refuses. Three rooms, three verbs, one wire. done [← Chapter 8 exercises](https://www.davisgeometric.com/gigi/gigi-builds/exercises/ch08.html)[Chapter 10 exercises →](https://www.davisgeometric.com/gigi/gigi-builds/exercises/ch10.html)