pub fn collect_capped_edges(
fragments: &[Fragment],
repo_root: Option<&Path>,
skip_expensive: bool,
) -> CappedEdgesExpand description
Two-pass edge construction that never retains the raw edge universe as keyed dictionaries and runs every builder exactly once.
Pass 1 runs every builder and records its emissions into a compact
per-builder log of (src, dst, weight) triples (16 bytes/edge, builder
tag implicit in the outer index); a first-seen scan in builder
registration order reproduces dedup_compact_edges semantics exactly
(each pair counted once, category from the first builder that
produced it) and yields per-node in-degree, per-source out-degree,
the semantic distinct-file fan counts, and the sorted category table.
Pass 2 replays the log instead of rerunning the builders, damps each emission on the fly with the pass-1 hub-suppression factors — always under the pair’s canonical first-builder category — and keeps at most K candidates per source per builder in a bounded min-heap, freeing each builder’s log shard as it is consumed. Any edge evicted from a per-builder heap is outranked by K surviving same-source edges, so the final merge + dedup + cap over the survivors is bit-identical to capping the full materialized universe.