/**
 * GraphTraversal — unified traversal engine facade.
 *
 * Preserves the exact public API of the original god object while
 * delegating to focused algorithm modules:
 *
 *   - TraversalContext   — shared infra (cache, stats, validation)
 *   - GraphPathFinding   — shortest path, Dijkstra, A*, bidirectional A*
 *   - GraphTopology      — topo sort, connected component, common ancestors
 *   - GraphAnalysis      — levels, roots, reduction, closure
 *
 * BFS and DFS live here because they are small and injected as callbacks
 * into topology and analysis modules.
 *
 * ## Determinism Invariants
 *
 * 1. **BFS**: Nodes at equal depth visited in lexicographic nodeId order.
 * 2. **DFS**: Nodes visited in lexicographic nodeId order (leftmost first).
 * 3. **PQ/Dijkstra/A***: Equal-priority tie-break by lexicographic nodeId.
 * 4. **Kahn (topoSort)**: Zero-indegree nodes dequeued in lex order.
 * 5. **Neighbor lists**: Sorted by (neighborId, label), strict codepoint.
 * 6. **Direction 'both'**: union(out, in) deduped by (neighborId, label).
 * 7. **weightFn/heuristicFn purity**: Must be deterministic.
 * 8. **Never** rely on JS Map/Set iteration order.
 *
 * @module domain/services/query/GraphTraversal
 */
import type NeighborProviderPort from '../../../ports/NeighborProviderPort.ts';
import type { Direction, NeighborOptions } from '../../../ports/NeighborProviderPort.ts';
import type LoggerPort from '../../../ports/LoggerPort.ts';
import { type RunStats, type TraversalStats, type TraversalHooks } from './TraversalContext.ts';
import GraphPathFinding from './GraphPathFinding.ts';
import GraphTopology from './GraphTopology.ts';
import GraphAnalysis from './GraphAnalysis.ts';
export type GraphTraversalStreamParams = {
    readonly start: string;
    readonly direction?: Direction | undefined;
    readonly options?: NeighborOptions | undefined;
    readonly maxNodes?: number | undefined;
    readonly maxDepth?: number | undefined;
    readonly signal?: AbortSignal | undefined;
    readonly hooks?: TraversalHooks | undefined;
};
export default class GraphTraversal {
    private readonly _ctx;
    private readonly _pathFinding;
    private readonly _topology;
    private readonly _analysis;
    constructor(params: {
        provider: NeighborProviderPort;
        logger?: LoggerPort;
        neighborCacheSize?: number;
    });
    bfs(params: GraphTraversalStreamParams): Promise<{
        nodes: string[];
        stats: TraversalStats;
    }>;
    bfsStream(params: GraphTraversalStreamParams): AsyncGenerator<string>;
    private _bfsStream;
    dfs(params: GraphTraversalStreamParams): Promise<{
        nodes: string[];
        stats: TraversalStats;
    }>;
    dfsStream(params: GraphTraversalStreamParams): AsyncGenerator<string>;
    private _dfsStream;
    shortestPath(params: Parameters<GraphPathFinding['shortestPath']>[0]): Promise<{
        found: boolean;
        path: string[];
        length: number;
        stats: TraversalStats;
    }>;
    isReachable(params: Parameters<GraphPathFinding['isReachable']>[0]): Promise<{
        reachable: boolean;
        stats: TraversalStats;
    }>;
    weightedShortestPath(params: Parameters<GraphPathFinding['weightedShortestPath']>[0]): Promise<{
        path: string[];
        totalCost: number;
        stats: TraversalStats;
    }>;
    aStarSearch(params: Parameters<GraphPathFinding['aStarSearch']>[0]): Promise<{
        path: string[];
        totalCost: number;
        nodesExplored: number;
        stats: TraversalStats;
    }>;
    bidirectionalAStar(params: Parameters<GraphPathFinding['bidirectionalAStar']>[0]): Promise<{
        path: string[];
        totalCost: number;
        nodesExplored: number;
        stats: TraversalStats;
    }>;
    connectedComponent(params: Parameters<GraphTopology['connectedComponent']>[0]): Promise<{
        nodes: string[];
        stats: TraversalStats;
    }>;
    topologicalSort(params: Parameters<GraphTopology['topologicalSort']>[0]): Promise<{
        sorted: string[];
        hasCycle: boolean;
        stats: TraversalStats;
        _neighborEdgeMap?: Map<string, import("../../../ports/NeighborProviderPort.ts").NeighborEdge[]>;
    }>;
    commonAncestors(params: Parameters<GraphTopology['commonAncestors']>[0]): Promise<{
        ancestors: string[];
        stats: TraversalStats;
    }>;
    weightedLongestPath(params: Parameters<GraphTopology['weightedLongestPath']>[0]): Promise<{
        path: string[];
        totalCost: number;
        stats: TraversalStats;
    }>;
    levels(params: Parameters<GraphAnalysis['levels']>[0]): Promise<{
        levels: Map<string, number>;
        maxLevel: number;
        stats: TraversalStats;
    }>;
    rootAncestors(params: Parameters<GraphAnalysis['rootAncestors']>[0]): Promise<{
        roots: string[];
        stats: TraversalStats;
    }>;
    transitiveReduction(params: Parameters<GraphAnalysis['transitiveReduction']>[0]): Promise<{
        edges: Array<{
            from: string;
            to: string;
            label: string;
        }>;
        removed: number;
        stats: TraversalStats;
    }>;
    transitiveClosure(params: Parameters<GraphAnalysis['transitiveClosure']>[0]): Promise<{
        edges: Array<{
            from: string;
            to: string;
        }>;
        stats: TraversalStats;
    }>;
    transitiveClosureStream(params: Parameters<GraphAnalysis['transitiveClosureStream']>[0]): AsyncGenerator<{
        from: string;
        to: string;
    }, void, any>;
    _newRunStats(): RunStats;
    _reconstructPath(predMap: Map<string, string>, start: string, goal: string): string[];
    _shouldUpdatePredecessor(predMap: Map<string, string>, nodeId: string, candidatePred: string): boolean;
    _findTopoCycleWitness(params: {
        discovered: Set<string>;
        sorted: string[];
        getNeighborIds: (nodeId: string) => Promise<string[]>;
    }): Promise<{
        from?: string;
        to?: string;
    }>;
    _biAStarExpand(params: Parameters<GraphPathFinding['_biAStarExpand']>[0]): Promise<{
        explored: number;
        mu: number;
        meeting: string | null;
    }>;
    _prepareTransitiveClosure(params: Parameters<GraphAnalysis['_prepareTransitiveClosure']>[0]): Promise<{
        nodeList: string[];
        nodesVisited: number;
    }>;
}
