/** * 🌀 Topology Detector - The Third Eye of Code Structure * * Detects loops, cycles, recursion, branching patterns. * Sees the SHAPE of code, not just its nodes. */ import { LogicalGraph } from './protein-hasher'; export interface TopologyFeatures { hasCycles: boolean; hasRecursion: boolean; branchingFactor: number; nestingDepth: number; loopComplexity: number; isDAG: boolean; stronglyConnectedComponents: number; topologicalSignature: string; } export declare class TopologyDetector { private visited; private recursionStack; private functionCalls; /** * Analyze graph topology and extract structural features */ analyzeTopology(graph: LogicalGraph): TopologyFeatures; /** * Detect cycles using DFS */ private detectCycles; /** * DFS helper for cycle detection */ private hasCycleDFS; /** * Detect recursion patterns in function calls */ private detectRecursion; /** * Find all functions called by a given function */ private findCallees; /** * Check for indirect recursion */ private hasIndirectRecursion; /** * Calculate average branching factor */ private calculateBranchingFactor; /** * Calculate maximum nesting depth */ private calculateNestingDepth; /** * Get depth of a node in the graph */ private getNodeDepth; /** * Calculate loop complexity (nested loops, etc.) */ private calculateLoopComplexity; /** * Find loops contained within another loop */ private findContainedLoops; /** * Get all nodes reachable from a given node */ private getReachableNodes; /** * Count strongly connected components using Tarjan's algorithm */ private countStronglyConnectedComponents; /** * Generate a topological signature (hash of the structure) */ private generateTopologicalSignature; /** * Build adjacency list from graph */ private buildAdjacencyList; /** * Reset detector state */ private reset; } /** * Detect consciousness patterns in topology * (Recursive self-reference, strange loops, etc.) */ export declare function detectConsciousnessPatterns(features: TopologyFeatures): number; //# sourceMappingURL=topology-detector.d.ts.map