/** * Knowledge Graph Engine for Memorai * Provides entity relationship management and graph-based memory operations */ export interface GraphEntity { id: string; name: string; type: string; properties: Record; createdAt: Date; updatedAt: Date; tenant_id: string; agent_id?: string; } export interface GraphRelation { id: string; fromId: string; toId: string; type: string; properties: Record; weight: number; confidence: number; createdAt: Date; updatedAt: Date; tenant_id: string; agent_id?: string; } export interface GraphQuery { entityTypes?: string[]; relationTypes?: string[]; properties?: Record; maxDepth?: number; limit?: number; tenant_id: string; agent_id?: string; } export interface GraphPath { entities: GraphEntity[]; relations: GraphRelation[]; totalWeight: number; confidence: number; } export interface GraphAnalytics { entityCount: number; relationCount: number; avgRelationsPerEntity: number; strongestConnections: Array<{ from: string; to: string; weight: number; }>; entityTypeDistribution: Record; relationTypeDistribution: Record; clustersDetected: number; centralEntities: Array<{ entity: GraphEntity; centrality: number; }>; } /** * Advanced Knowledge Graph for entity-relationship memory storage */ export declare class KnowledgeGraph { private entities; private relations; private entityRelations; private relationIndex; /** * Add or update an entity in the knowledge graph */ addEntity(name: string, type: string, properties: Record, tenant_id: string, agent_id?: string): Promise; /** * Add a relation between two entities */ addRelation(fromId: string, toId: string, relationType: string, properties: Record | undefined, weight: number | undefined, confidence: number | undefined, tenant_id: string, agent_id?: string): Promise; /** * Find entities by criteria */ findEntities(query: GraphQuery): GraphEntity[]; /** * Get a specific entity by ID */ getEntity(id: string): GraphEntity | null; /** * Get a specific relation by ID */ getRelation(id: string): GraphRelation | null; /** * Find relations based on query criteria */ findRelations(query: GraphQuery): GraphRelation[]; /** * Find all paths between two entities */ findPaths(fromId: string, toId: string, maxDepth?: number): GraphPath[]; /** * Find shortest path between two entities */ findShortestPath(fromId: string, toId: string, maxDepth?: number): GraphPath | null; /** * Get all connected entities within specified depth */ getConnectedEntities(entityId: string, maxDepth?: number): GraphEntity[]; /** * Get graph analytics and insights */ getAnalytics(tenant_id: string, agent_id?: string): GraphAnalytics; /** * Remove an entity and all its relations */ removeEntity(entityId: string): Promise; /** * Remove a specific relation */ removeRelation(relationId: string): Promise; /** * Export graph data */ exportGraph(tenant_id: string, agent_id?: string): { entities: GraphEntity[]; relations: GraphRelation[]; }; /** * Import graph data */ importGraph(data: { entities: GraphEntity[]; relations: GraphRelation[]; }): Promise; private findEntityByNameAndType; private findExistingRelation; private detectClusters; private dfsCluster; } //# sourceMappingURL=KnowledgeGraph.d.ts.map