/** * Generic bounded level-BFS over an arbitrary graph. * * Extracted from the caller-graph BFS in this package's own * `dependency-graph.ts` (`bfsTransitiveCallers` / `expandFrontier`, since * lifted here from `@liendev/review` — it never imported anything * review-specific to begin with). This file * keeps the traversal *shape* — frontier expansion, dedup, depth cap, maxNodes * truncation — generic and domain-agnostic. Callers supply the domain (what a * "node" and an "edge" are, and how to get from one to the other); this module * does not know anything about symbols, callers, or files. */ export interface BoundedBfsOptions { /** Max hop distance from the seed. Unbounded if omitted. */ depth?: number; /** Max edges to emit before stopping. Unbounded if omitted. */ maxNodes?: number; } export interface BoundedBfsEdgeResult { /** The edge as returned by `getNeighbors`. */ edge: TEdge; /** The node whose neighbors produced this edge (the BFS predecessor). */ fromNode: TNode; /** Hop distance from the seed. Direct neighbors of the seed are 1. */ hops: number; } export interface BoundedBfsResult { results: Array>; /** True if the walk stopped because it hit maxNodes before exploring the full graph. */ truncated: boolean; /** Count of distinct nodes whose neighbors were expanded (for diagnostics). */ visitedCount: number; } /** * BFS-walk outward from `seed` up to `opts.depth` hops. Each reachable node is * emitted exactly once (via its edge), at its shortest hop distance from the * seed. Stops once `opts.maxNodes` edges have been emitted (sets * `truncated: true`). * * @param seed - The starting node. * @param getNeighbors - Returns the outgoing edges of a node. * @param getNextNode - Extracts the node an edge leads to. * @param getEdgeKey - Dedup key for the node an edge leads to (equivalent to * `getNodeKey(getNextNode(edge))`, but callers may compute it more directly). * @param getNodeKey - Dedup key for a node — must produce the same key format * as `getEdgeKey` for equivalent nodes. */ export declare function walkBounded(seed: TNode, getNeighbors: (node: TNode) => TEdge[], getNextNode: (edge: TEdge) => TNode, getEdgeKey: (edge: TEdge) => string, getNodeKey: (node: TNode) => string, opts?: BoundedBfsOptions): BoundedBfsResult; //# sourceMappingURL=bounded-bfs.d.ts.map