/** * @nahisaho/yata-scale - Graph Index * * Graph-specific indexes for efficient traversal */ import type { IndexStats, RelationshipType, Relationship } from '../types.js'; /** * Edge in the graph */ export interface Edge { readonly id: string; readonly sourceId: string; readonly targetId: string; readonly type: RelationshipType; readonly weight?: number; } /** * Path in the graph */ export interface GraphPath { readonly nodes: string[]; readonly edges: string[]; readonly length: number; readonly weight: number; } /** * Graph index for efficient traversal operations */ export declare class GraphIndex { private outgoing; private incoming; private byType; private edges; constructor(); /** * Add an edge to the index */ addEdge(edge: Edge): void; /** * Add edge from relationship */ addRelationship(rel: Relationship): void; /** * Remove an edge */ removeEdge(edgeId: string): boolean; /** * Get outgoing edges from a node */ getOutgoingEdges(nodeId: string): Edge[]; /** * Get incoming edges to a node */ getIncomingEdges(nodeId: string): Edge[]; /** * Get all edges for a node (both directions) */ getAllEdges(nodeId: string): Edge[]; /** * Get outgoing neighbors */ getOutgoingNeighbors(nodeId: string): string[]; /** * Get incoming neighbors */ getIncomingNeighbors(nodeId: string): string[]; /** * Get neighbors within k hops */ getNeighbors(nodeId: string, depth: number, direction?: 'outgoing' | 'incoming' | 'both'): Set; /** * Find shortest path using BFS */ findShortestPath(source: string, target: string, maxDepth?: number): GraphPath | null; /** * Find all paths (up to maxPaths) */ findAllPaths(source: string, target: string, maxDepth?: number, maxPaths?: number): Generator; /** * Get edges by type */ getEdgesByType(type: RelationshipType): Edge[]; /** * Check if edge exists between two nodes */ hasEdge(sourceId: string, targetId: string): boolean; /** * Get edge between two nodes */ getEdge(sourceId: string, targetId: string): Edge | undefined; /** * Get node degree */ getDegree(nodeId: string, direction?: 'in' | 'out' | 'total'): number; /** * Clear the index */ clear(): void; /** * Get edge count */ get size(): number; /** * Get node count */ get nodeCount(): number; /** * Get index statistics */ getStats(): IndexStats; /** * Estimate memory size */ private estimateSize; } //# sourceMappingURL=GraphIndex.d.ts.map