/** * Global Compliance Graph (GCG) * * Graph-based representation of compliance relationships between * entities, rules, jurisdictions, and decisions (Enhancement #18). */ import type { GraphNode, GraphEdge } from '@arka-protocol/types'; /** * Node types in the compliance graph */ export type ComplianceNodeType = 'ENTITY' | 'RULE' | 'JURISDICTION' | 'DECISION' | 'EVENT' | 'REGULATION' | 'RISK_FACTOR' | 'PATTERN'; /** * Edge types in the compliance graph */ export type ComplianceEdgeType = 'APPLIES_TO' | 'EVALUATED_BY' | 'RESULTED_IN' | 'GOVERNS' | 'IMPLEMENTS' | 'RELATED_TO' | 'DEPENDS_ON' | 'CONFLICTS_WITH' | 'OWNED_BY' | 'TRIGGERED' | 'INDICATES' | 'MITIGATED_BY'; /** * Compliance graph node */ export interface ComplianceGraphNode extends Omit { /** Node type */ nodeType: ComplianceNodeType; /** Node label */ label: string; /** Properties */ properties: Record; /** Timestamps */ createdAt: string; updatedAt?: string; /** Validity period */ validFrom?: string; validTo?: string; } /** * Compliance graph edge */ export interface ComplianceGraphEdge extends Omit { /** Edge type */ edgeType: ComplianceEdgeType; /** Source node ID (alias for fromNodeId) */ sourceId: string; /** Target node ID (alias for toNodeId) */ targetId: string; /** Weight/strength of relationship */ weight?: number; /** Properties */ properties?: Record; /** When this relationship was established */ establishedAt: string; /** Validity period */ validFrom?: string; validTo?: string; } /** * Graph query result */ export interface GraphQueryResult { nodes: ComplianceGraphNode[]; edges: ComplianceGraphEdge[]; paths?: GraphPath[]; } /** * Path in the graph */ export interface GraphPath { nodes: string[]; edges: string[]; length: number; totalWeight?: number; } /** * Graph statistics */ export interface GraphStats { nodeCount: number; edgeCount: number; nodesByType: Record; edgesByType: Record; avgDegree: number; maxDegree: number; connectedComponents: number; } /** * Compliance Graph implementation */ export declare class ComplianceGraph { private nodes; private edges; private adjacencyList; private reverseAdjacency; /** * Add a node to the graph */ addNode(node: ComplianceGraphNode): void; /** * Add an edge to the graph */ addEdge(edge: ComplianceGraphEdge): void; /** * Get node by ID */ getNode(nodeId: string): ComplianceGraphNode | undefined; /** * Get edge by ID */ getEdge(edgeId: string): ComplianceGraphEdge | undefined; /** * Remove a node and all connected edges */ removeNode(nodeId: string): boolean; /** * Get neighbors of a node */ getNeighbors(nodeId: string, direction?: 'out' | 'in' | 'both'): ComplianceGraphNode[]; /** * Get edges for a node */ getEdgesForNode(nodeId: string, direction?: 'out' | 'in' | 'both'): ComplianceGraphEdge[]; /** * Find shortest path between nodes */ findShortestPath(sourceId: string, targetId: string): GraphPath | null; /** * Find all paths between nodes (up to maxLength) */ findAllPaths(sourceId: string, targetId: string, maxLength?: number): GraphPath[]; /** * Query nodes by type and properties */ queryNodes(query: { type?: ComplianceNodeType; properties?: Record; validAt?: string; }): ComplianceGraphNode[]; /** * Query edges by type */ queryEdges(query: { type?: ComplianceEdgeType; sourceType?: ComplianceNodeType; targetType?: ComplianceNodeType; validAt?: string; }): ComplianceGraphEdge[]; /** * Get subgraph around a node */ getSubgraph(centerNodeId: string, depth?: number): GraphQueryResult; /** * Get graph statistics */ getStats(): GraphStats; /** * Export to JSON */ toJSON(): { nodes: ComplianceGraphNode[]; edges: ComplianceGraphEdge[]; }; /** * Import from JSON */ static fromJSON(data: { nodes: ComplianceGraphNode[]; edges: ComplianceGraphEdge[]; }): ComplianceGraph; private countConnectedComponents; } /** * Create a compliance graph */ export declare function createComplianceGraph(): ComplianceGraph; //# sourceMappingURL=complianceGraph.d.ts.map