Section 4.7Source:
server/src/analytics/connectivity/FanInOutAnalyzer.tsConnectivity & Degree Analysis
O(1) measurement of incoming (fan-in) and outgoing (fan-out) node degree, God-node detection, and architectural instability.
Source:
server/src/analytics/connectivity/FanInOutAnalyzer.ts$O(1)$ Edge Counting Algorithm
Because GraphBuilder maintains pre-indexed edge sets, calculating a node's degree requires zero iteration:
server/src/analytics/connectivity/FanInOutAnalyzer.ts
1234567891011121314export class FanInOutAnalyzer { constructor(private readonly graph: Graph) {} analyze(nodeId: string): FanInOutResult { const incomingEdges = this.graph.incomingEdges.get(nodeId) ?? new Set(); const outgoingEdges = this.graph.outgoingEdges.get(nodeId) ?? new Set(); return { nodeId, fanIn: incomingEdges.size, // O(1) fanOut: outgoingEdges.size, // O(1) }; } }
Architectural Diagnostic Matrix
Comparing fan-in and fan-out identifies structural archetypes:
| Pattern | Fan-In | Fan-Out | Architectural Assessment |
|---|---|---|---|
| Utility / Leaf | High | Low | Ideal foundational helper. Widely reused, low blast risk. |
| Entry Point | Low / 0 | High | Normal for top-level bootstrap scripts or main routers. |
| God Node / Hub | High | High | Architectural bottleneck. High coupling, dangerous to modify. |
| Isolated Node | 0 | 0 | Dead code candidate. Completely disconnected from the graph. |