import type { HNSWConfig, HNSWSearchCandidate, HNSWSerializedState } from '../../types/index.js';
/**
 * HNSW (Hierarchical Navigable Small World) index.
 * For corpus < flatSearchThreshold, delegates to brute-force flat search.
 */
export declare class HNSWIndex {
    private readonly config;
    private readonly nodes;
    private entryPoint;
    private maxLayer;
    constructor(config?: Partial<HNSWConfig>);
    /** Number of indexed vectors. */
    get size(): number;
    /** Insert a vector into the index. */
    insert(id: string, vector: number[]): void;
    /** Remove a vector from the index. */
    remove(id: string): boolean;
    /** Search for the top-K nearest neighbors. Uses flat search for small corpus. */
    search(query: number[], topK: number): HNSWSearchCandidate[];
    /** Brute-force flat search -- guaranteed recall = 1.0. */
    private flatSearch;
    /** HNSW graph search -- approximate, O(log n). */
    private hnswSearch;
    /** Greedy walk to the closest node in a given layer. */
    private greedyClosest;
    /** Search a single layer, returning ef closest candidates. */
    private searchLayer;
    /** Prune connections to keep at most M neighbors. */
    private pruneConnections;
    /** Random level for a new node (geometric distribution). */
    private randomLevel;
    /** Export the index for serialization. */
    exportState(): HNSWSerializedState;
    /** Import the index from serialized form. */
    importState(state: HNSWSerializedState): void;
}
//# sourceMappingURL=hnsw.d.ts.map