/** * Exact global minimum cut over an undirected weighted graph. * * Fast path: `ruvector`'s `DynamicMinCut`, a wrapper over the * `@ruvector/mincut-wasm` solver that ruvector ships as one of its own * optional dependencies. Measured on a 1,000-node / 2,000-edge graph it is * ~30x faster than a JS Stoer-Wagner (187 ms vs 6 s) and returns the same cut * value. When ruvector or its wasm solver is not installed, callers fall back * to their own JS implementation (`fallbackMinCut` in graph-analyzer.ts). * * The wasm solver rejects duplicate edges ("Edge already exists"), so edges are * folded into one undirected edge per node pair with summed weight, and * self-loops are dropped (they never cross a cut). */ export interface MinCutResult { cutValue: number; partition1: string[]; partition2: string[]; cutEdges: Array<[string, string]>; } export type MinCutBackend = 'mincut-wasm' | 'js-fallback'; interface DynamicMinCutLike { insertEdge(from: string, to: string, weight?: number): number; minCutValue(): number; partition(): string[][]; } export type DynamicMinCutCtor = new () => DynamicMinCutLike; /** * Resolve ruvector's `DynamicMinCut` once. Returns null (never throws) when * ruvector is absent or its `@ruvector/mincut-wasm` solver cannot load. */ export declare function loadWasmMinCut(): Promise; /** Test hook: forget the memoised loader result. */ export declare function resetMinCutLoader(): void; /** * Compute the exact minimum cut with the wasm solver. Returns null when the * solver is unavailable or the input is degenerate (fewer than two nodes, no * edges, or nodes with no incident edge — an isolated node is a zero-weight * cut that the solver never sees, so the JS fallback answers those). */ export declare function wasmMinCut(nodes: string[], edges: Array<[string, string, number]>): Promise; /** Synchronous variant for callers that already hold the loaded solver class. */ export declare function minCutWith(Ctor: DynamicMinCutCtor, nodes: string[], edges: Array<[string, string, number]>): MinCutResult | null; export interface SeedMinCutResult { /** Nodes on the seed's side of the cut, nearest (fewest hops) first. */ seedSide: Array<{ nodeId: string; depth: number; }>; otherSide: string[]; cutValue: number; cutEdges: Array<[string, string]>; backend: MinCutBackend; /** Size of the seed's depth-bounded neighbourhood the cut was computed on. */ subgraphNodes: number; } /** Above this many nodes the O(n^3) JS fallback is not attempted. */ export declare const JS_FALLBACK_MAX_NODES = 300; /** * Minimum cut of the seed's `depth`-hop neighbourhood (edges treated as * undirected, at most `maxNodes` nodes). Answers "where is the weakest * boundary around this node, and what sits on its side of it?". * * Uses the wasm solver when available, else `fallback` (a JS exact min cut) * for neighbourhoods up to JS_FALLBACK_MAX_NODES nodes. Returns null when the * seed has no neighbours or no backend can handle the neighbourhood. */ export declare function seedLocalMinCut(seed: string, edges: Array<[string, string, number]>, depth: number, maxNodes: number, fallback: (nodes: string[], edges: Array<[string, string, number]>) => MinCutResult): Promise; export {}; //# sourceMappingURL=mincut-bridge.d.ts.map