/** * ═══════════════════════════════════════════════════════════════════════════════ * PROMPTSPEAK GRAPH MANAGER * ═══════════════════════════════════════════════════════════════════════════════ * * Graph traversal and relationship management for PromptSpeak symbols. * Implements patterns from: * - Microsoft GraphRAG subgraph retrieval * - Neo4j Cypher traversal patterns * - SQLite recursive CTEs for path finding * * Key Features: * - N-hop neighborhood retrieval * - Shortest path finding * - Relationship type filtering * - Weighted traversal * - Bidirectional queries * * ═══════════════════════════════════════════════════════════════════════════════ */ import { type RelationshipType, type SymbolRelationship, type CreateRelationshipRequest, type RelationshipQueryOptions, type TraversalOptions, type NeighborhoodResult, type PathResult, type PathInfo, type RelatedSymbolsResult, type SymbolCentrality, type GraphStats } from './graph-types.js'; export declare class GraphManager { private stmtInsertRelationship; private stmtGetRelationship; private stmtDeleteRelationship; private stmtGetOutgoing; private stmtGetIncoming; private stmtGetBidirectional; private stmtCountByType; private stmtCentrality; private initialized; constructor(); private ensureInitialized; /** * Create a new relationship between symbols. */ createRelationship(request: CreateRelationshipRequest): { success: boolean; relationshipId?: number; error?: string; }; /** * Get a relationship by ID. */ getRelationship(id: number): SymbolRelationship | null; /** * Delete a relationship by ID. */ deleteRelationship(id: number): boolean; /** * Delete all relationships involving a symbol. */ deleteSymbolRelationships(symbolId: string): number; /** * Get all relationships from a symbol (outgoing). */ getOutgoingRelationships(symbolId: string, options?: RelationshipQueryOptions): SymbolRelationship[]; /** * Get all relationships to a symbol (incoming). */ getIncomingRelationships(symbolId: string, options?: RelationshipQueryOptions): SymbolRelationship[]; /** * Get all related symbols (both directions). */ getRelatedSymbols(symbolId: string, options?: RelationshipQueryOptions): RelatedSymbolsResult; /** * Get the neighborhood of a symbol (N-hop traversal). * Uses recursive CTE for efficient graph traversal. */ getNeighborhood(symbolId: string, options?: TraversalOptions): NeighborhoodResult; /** * Find paths between two symbols. * Uses recursive CTE with cycle detection. */ findPaths(fromSymbolId: string, toSymbolId: string, options?: TraversalOptions): PathResult; /** * Find the shortest path between two symbols. */ findShortestPath(fromSymbolId: string, toSymbolId: string, options?: TraversalOptions): PathInfo | null; /** * Get centrality metrics for top symbols. */ getTopSymbolsByCentrality(limit?: number): SymbolCentrality[]; /** * Get graph-level statistics. */ getGraphStats(): GraphStats; /** * Create multiple relationships in a transaction. */ createRelationshipsBatch(requests: CreateRelationshipRequest[]): { success: boolean; created: number; errors: string[]; }; /** * Import relationships from extracted document data. */ importExtractedRelationships(relationships: Array<{ from: string; to: string; type: RelationshipType; confidence: number; evidence?: string; }>, options?: { createdBy?: string; minConfidence?: number; }): { imported: number; skipped: number; }; private rowToRelationship; private filterRelationships; } export declare function getGraphManager(): GraphManager; export declare function resetGraphManager(): void; //# sourceMappingURL=graph-manager.d.ts.map