/**
 * TraversalContext — shared infrastructure for graph traversal algorithms.
 *
 * Holds the neighbor provider, LRU cache, logger, and exposes the common
 * operations (neighbor lookup, start validation, stats, weight resolution,
 * path reconstruction) that all algorithm modules need.
 *
 * One instance per GraphTraversal; algorithm modules receive it as a
 * constructor parameter.
 *
 * @module domain/services/query/TraversalContext
 */
import type NeighborProviderPort from '../../../ports/NeighborProviderPort.ts';
import type { Direction, NeighborEdge, NeighborOptions } from '../../../ports/NeighborProviderPort.ts';
import type LoggerPort from '../../../ports/LoggerPort.ts';
export type RunStats = {
    cacheHits: number;
    cacheMisses: number;
    edgesTraversed: number;
};
export type TraversalStats = {
    nodesVisited: number;
    edgesTraversed: number;
    cacheHits: number;
    cacheMisses: number;
};
export type TraversalHooks = {
    onVisit?: (nodeId: string, depth: number) => void;
    onExpand?: (nodeId: string, neighbors: NeighborEdge[]) => void;
};
export type WeightFn = (from: string, to: string, label: string) => number | Promise<number>;
export type BfsFn = (params: {
    start: string;
    direction?: Direction | undefined;
    options?: NeighborOptions | undefined;
    maxNodes?: number | undefined;
    maxDepth?: number | undefined;
    signal?: AbortSignal | undefined;
    hooks?: TraversalHooks | undefined;
}) => Promise<{
    nodes: string[];
    stats: TraversalStats;
}>;
export type TopoSortFn = (params: {
    start: string | string[];
    direction?: Direction;
    options?: NeighborOptions;
    maxNodes?: number;
    throwOnCycle?: boolean;
    signal?: AbortSignal;
    _returnAdjList?: boolean;
    _lightweight?: boolean;
}) => Promise<{
    sorted: string[];
    hasCycle: boolean;
    stats: TraversalStats;
    _neighborEdgeMap?: Map<string, NeighborEdge[]>;
}>;
export declare const DEFAULT_MAX_NODES = 100000;
export declare const DEFAULT_MAX_DEPTH = 1000;
export declare const DEFAULT_WEIGHT_FN: WeightFn;
/**
 * Lexicographic nodeId comparator for MinHeap tie-breaking.
 */
export declare const lexTieBreaker: (a: string, b: string) => number;
/**
 * Strips keys whose value is `undefined` from an object so that
 * `exactOptionalPropertyTypes` doesn't complain about explicit `undefined`.
 */
export declare function stripUndefined<T extends Record<string, unknown>>(obj: T): T;
/**
 * Distinguishes true topological cycles from maxNodes truncation.
 */
export declare function computeTopoHasCycle(params: {
    sortedLength: number;
    discoveredSize: number;
    maxNodes: number;
    readyRemaining: boolean;
}): boolean;
export default class TraversalContext {
    readonly provider: NeighborProviderPort;
    readonly logger: LoggerPort;
    private readonly _neighborCache;
    constructor(params: {
        provider: NeighborProviderPort;
        logger?: LoggerPort;
        neighborCacheSize?: number;
    });
    newRunStats(): RunStats;
    stats(nodesVisited: number, rs: RunStats): TraversalStats;
    getNeighbors(nodeId: string, direction: Direction, rs: RunStats, options?: NeighborOptions): Promise<NeighborEdge[]>;
    validateStart(nodeId: string): Promise<void>;
    resolveWeightFn(weightFn: WeightFn | undefined, nodeWeightFn: ((nodeId: string) => number | Promise<number>) | undefined): WeightFn;
    reconstructPath(predMap: Map<string, string>, start: string, goal: string): string[];
    reconstructBiPath(fwdPrev: Map<string, string>, bwdNext: Map<string, string>, start: string, goal: string, meeting: string): string[];
    shouldUpdatePredecessor(predMap: Map<string, string>, nodeId: string, candidatePred: string): boolean;
    private _buildNodeWeightResolver;
}
