Expand description
Shared seeded, depth-limited subgraph traversal (entry-point-agnostic, format-agnostic). Backs the Archify exporter and future seeded exports. Shared seeded, depth-limited subgraph builder.
This is the reusable traversal primitive behind seeded exports (today the
Archify architecture exporter). It is deliberately entry-point-agnostic:
it takes a set of concrete [NodeId] seeds and walks the graph. Resolving
which nodes are seeds (by symbol name, file, or entry-point heuristic) is a
higher-layer concern and stays out of sqry-core (entry-point detection
lives in sqry-db). The builder never invents seeds.
It is also format-agnostic: the caller supplies an edge classifier that
decides, per [EdgeKind], whether an edge is retained (and under what
caller-defined class) and whether the traversal follows it. This keeps each
export format’s edge-retention policy fully independent. In particular the
Archify path classifies (and retains) semantically rich cross-service edges
(HttpRequest, DbQuery, MessageQueue, …) that the raw dot / d2 /
mermaid / json exporters intentionally drop, and it does so through its own
classifier so those existing formats are provably unchanged.
§Determinism
Every ordering decision is explicit and stable so identical input yields byte-identical output, including across parallel (rayon) graph rebuilds where the underlying arena/edge iteration order can differ:
- Seeds are sorted by
NodeIdindex and de-duplicated before the walk. - Outgoing edges of each node are sorted by
(target index, edge-kind discriminant, sequence)before they are recorded or enqueued. - BFS uses a per-node visited set keyed on
NodeId(never on qualified name), so same-named nodes in unrelated files never fuse.
The resulting [SeededSubgraph::nodes] is in stable BFS discovery order and
[SeededSubgraph::edges] is in stable emission order.
Structs§
- Edge
Retention - Decision returned by a caller-supplied edge classifier.
- Retained
Edge - A retained edge between two visited nodes, carrying the caller’s class.
- Seeded
Subgraph - The result of a seeded subgraph walk.
- Seeded
Subgraph Config - Configuration for a seeded subgraph walk.
Constants§
- DEFAULT_
MAX_ DEPTH - Default BFS depth (hops from the seed) for a seeded subgraph.
- DEFAULT_
MAX_ RESULTS - Default cap on the number of raw nodes visited during BFS.
- MAX_
DEPTH_ CAP - Hard cap on BFS depth. Anything deeper is already too dense to read.
Functions§
- build_
seeded_ subgraph - Build a seeded, depth-limited subgraph.