MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / getImpactRadius

Method getImpactRadius

src/graph/traversal.ts:520–541  ·  view source on GitHub ↗

* Calculate the impact radius of a node * * Returns all nodes that could be affected by changes to this node. * * @param nodeId - ID of the node * @param maxDepth - Maximum depth to traverse (default: 3) * @returns Subgraph containing potentially impacted nodes

(nodeId: string, maxDepth: number = 3)

Source from the content-addressed store, hash-verified

518 * @returns Subgraph containing potentially impacted nodes
519 */
520 getImpactRadius(nodeId: string, maxDepth: number = 3): Subgraph {
521 const focalNode = this.queries.getNodeById(nodeId);
522 if (!focalNode) {
523 return { nodes: new Map(), edges: [], roots: [] };
524 }
525
526 const nodes = new Map<string, Node>();
527 const edges: Edge[] = [];
528 const visited = new Set<string>();
529
530 // Add focal node
531 nodes.set(focalNode.id, focalNode);
532
533 // Traverse incoming edges to find all dependents
534 this.getImpactRecursive(nodeId, maxDepth, 0, nodes, edges, visited);
535
536 return {
537 nodes,
538 edges,
539 roots: [nodeId],
540 };
541 }
542
543 private getImpactRecursive(
544 nodeId: string,

Callers 2

impactOfMethod · 0.45
mainFunction · 0.45

Calls 3

getImpactRecursiveMethod · 0.95
getNodeByIdMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected