import { GraphExpander } from '../../interfaces/graph-expander'; /** * Result from ensemble expansion. */ export interface EnsembleExpansionResult { /** Discovered paths (enumerated through union subgraph) */ paths: Array<{ fromSeed: number; toSeed: number; nodes: string[]; }>; /** Union of all nodes visited by all strategies */ sampledNodes: Set; /** Set of edges visited during expansion */ sampledEdges: Set; /** Per-strategy sampled nodes (for diagnostics) */ sampledNodesPerStrategy: Map>; /** Statistics about the expansion */ stats: EnsembleExpansionStats; /** Map from node ID to the iteration when it was first discovered (across all strategies) */ nodeDiscoveryIteration: Map; } /** * Statistics collected during ensemble expansion. */ export interface EnsembleExpansionStats { /** Total nodes in union across all strategies */ totalUnionNodes: number; /** Breakdown of node counts per strategy */ nodesPerStrategy: Map; /** Overlap statistics between strategies */ strategyOverlap: Map; /** Total paths enumerated through union */ totalPaths: number; } /** * Ensemble Expansion (Union of BFS, DFS, Degree-Priority) * * Baseline algorithm that combines results from three different expansion * strategies: standard BFS, depth-first search (DFS), and degree-prioritised. * Enumerates all paths through the union of discovered subgraphs. * * **Key Properties**: * - Runs BFS, DFS, and degree-priority expansion independently * - Computes union of all visited nodes across strategies * - Enumerates ALL simple paths through union subgraph * - Terminates when all strategies complete * * **Experimental Purpose**: * Tests whether combining multiple exploration strategies provides better * coverage and path diversity than any single strategy alone. If ensemble * outperforms degree-prioritised, strategy diversity matters. If not, * a single well-chosen strategy suffices. * * **Note**: Path enumeration through large unions can be expensive. * Consider depth limits for tractability. * * @template T - Type of node data returned by expander */ export declare class EnsembleExpansion { private readonly expander; private readonly seeds; private readonly sampledEdges; private readonly nodeDiscoveryIteration; private stats; /** * Create a new ensemble expansion. * * @param expander - Graph expander providing neighbour access * @param seeds - Array of seed node IDs (N >= 1) * @throws Error if no seeds provided */ constructor(expander: GraphExpander, seeds: readonly string[]); /** * Run the ensemble expansion to completion. * * Executes BFS, DFS, and degree-priority strategies in sequence, * then enumerates paths through the union. * * @returns Ensemble results including paths and union subgraph */ run(): Promise; /** * Run standard BFS expansion. * @returns Set of visited nodes * @internal */ private runBfs; /** * Run depth-first search expansion. * @returns Set of visited nodes * @internal */ private runDfs; /** * Run degree-prioritised expansion. * @returns Set of visited nodes * @internal */ private runDegreePriority; /** * Enumerate all simple paths through the union subgraph. * Uses DFS with backtracking to find all paths between seed pairs. * * @param nodes - Union of nodes from all strategies * @returns Array of paths between all seed pairs * @internal */ private enumeratePathsThroughUnion; /** * Find all simple paths between two nodes within the sampled subgraph. * Uses DFS with backtracking and depth limit for tractability. * * @param start - Start node ID * @param end - End node ID * @param allowedNodes - Set of nodes in the sampled subgraph * @param maxDepth - Maximum path length to explore * @returns Array of simple paths (each path is array of node IDs) * @internal */ private findAllSimplePaths; } //# sourceMappingURL=ensemble-expansion.d.ts.map