Skip to main content

Module graph

Module graph 

Source

Structs§

CappedEdges
Output of the two-pass edge construction: the final damped, deduped, per-source-capped edge set plus cap stats derived from pass-1 counters. The category table is not carried here — assemble_graph derives it from this same post-cap edges vector, which is the only way to guarantee the exported category table and the CSR never disagree.
CompactEdge
A single node-interned edge. 24 bytes instead of a string-keyed hashmap entry — the difference between ~400 MB and several GB on multi-million-edge repositories (vendored Go monorepos, vscode), which is what used to OOM-kill memory-limited benchmark runners.
CompactEdges
Node-interned edge list: the memory-bounded intermediate between edge collection and graph construction. idx_to_node is the sorted, deduplicated fragment-id universe, so CSR node indexing built from it is identical to the ordering Graph::freeze produces.
CsrGraph
EdgeCapStats
Statistics from the per-source out-edge cap that runs in build_graph after apply_hub_suppression. Surfaced to Python via LatencyBreakdown so calibration runs can quantify how often the cap fires and how many edges it discards.
EdgeCategoryTable
Compact (src, dst) -> category lookup over the pre-cap edge set. Replaces the FragmentId-pair-keyed hashmap that used to retain the full uncapped edge universe for the lifetime of the pipeline.
Graph
RankedCandidate
Candidate out-edge ranked by post-suppression weight. The ordering replicates the sort in cap_out_edges_per_source (descending weight, ties by ascending dst index), so a bounded min-heap of these keeps exactly the edges the full sort-and-truncate would keep.
SuppressionFactors
Hub-suppression damping factors, precomputed from dedup-aware degree counters so the damped weight of any edge can be evaluated without materializing the edge universe. The per-edge arithmetic is identical to the historical in-place suppression loops: at most one division, by ln(1+in_degree) for non-exempt edges into hub destinations or by sqrt(fan) for Semantic edges out of wide-fan sources.

Enums§

EdgeCategory

Functions§

build_graph
Map-based adapter kept for tests and small callers; converts to the compact representation and delegates. Edges whose endpoints are not in fragments are dropped (the hashmap path silently dropped them at CSR construction).
build_graph_capped
Graph-construction path for pre-capped edges from the two-pass pipeline: suppression and the per-source cap already ran, so only the category table and CSR assembly remain.
build_graph_compact
Materialized-edge construction path kept for the map-based adapter and small callers: hub suppression, per-source cap, and CSR assembly all run on the interned edge array.
dedup_compact_edges
Merge duplicate (src, dst) entries: weight = max across duplicates, category = first occurrence in input order (builder order), matching the historical EdgeDict max-merge + or_insert category semantics. Requires a stable sort so first-in-input stays first-in-group — par_sort_by is a stable parallel merge sort, so its output is bit-identical to sort_by while cutting the dominant serial phase of a tens-of-millions-edge build (#196).
intern_fragment_nodes
push_bounded_top_k

Type Aliases§

SourceTopK