/**
 * Graph RAG Implementation
 *
 * Knowledge graph-based retrieval augmented generation.
 * Creates semantic relationships between document chunks and uses
 * random walk with restart for context-aware retrieval.
 */
import type { GraphNode, GraphEdge, GraphChunk, GraphEmbedding, RankedNode, GraphRAGConfig, GraphQueryParams, GraphStats } from "../../types/index.js";
/**
 * Graph-based Retrieval Augmented Generation
 *
 * Creates a knowledge graph from document chunks where nodes represent
 * documents and edges represent semantic relationships based on
 * embedding similarity.
 */
export declare class GraphRAG {
    private nodes;
    private edges;
    private dimension;
    private threshold;
    constructor(config?: GraphRAGConfig);
    /**
     * Create a knowledge graph from document chunks and embeddings
     *
     * @param chunks - Array of document chunks
     * @param embeddings - Corresponding embedding vectors
     */
    createGraph(chunks: GraphChunk[], embeddings: GraphEmbedding[]): void;
    /**
     * Query the graph using random walk with restart
     *
     * @param params - Query parameters including embedding vector
     * @returns Ranked nodes by relevance
     */
    query(params: GraphQueryParams): RankedNode[];
    /**
     * Add a single node to the graph
     *
     * @param chunk - Document chunk
     * @param embedding - Embedding vector
     * @returns Node ID
     */
    addNode(chunk: GraphChunk, embedding: GraphEmbedding): string;
    /**
     * Remove a node and its edges from the graph
     *
     * @param id - Node ID to remove
     * @returns True if node was removed
     */
    removeNode(id: string): boolean;
    /**
     * Get graph statistics
     */
    getStats(): GraphStats;
    /**
     * Get a node by ID
     */
    getNode(id: string): GraphNode | undefined;
    /**
     * Get all nodes
     */
    getAllNodes(): GraphNode[];
    /**
     * Get edges for a node
     */
    getEdges(nodeId: string): GraphEdge[];
    /**
     * Find connected components in the graph
     */
    findConnectedComponents(): string[][];
    /**
     * Calculate cosine similarity between two vectors
     */
    private cosineSimilarity;
    /**
     * Normalize probabilities to sum to 1
     */
    private normalizeProbs;
    /**
     * Weighted random choice
     */
    private weightedRandomChoice;
    /**
     * Update similarity threshold and rebuild edges
     */
    updateThreshold(threshold: number): void;
    /**
     * Serialize graph to JSON
     */
    toJSON(): {
        nodes: GraphNode[];
        edges: Array<{
            source: string;
            edges: GraphEdge[];
        }>;
        config: {
            dimension: number;
            threshold: number;
        };
    };
    /**
     * Load graph from JSON
     */
    static fromJSON(json: {
        nodes: GraphNode[];
        edges: Array<{
            source: string;
            edges: GraphEdge[];
        }>;
        config: {
            dimension: number;
            threshold: number;
        };
    }): GraphRAG;
}
