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

Method getChildren

src/graph/traversal.ts:720–732  ·  view source on GitHub ↗

* Get immediate children of a node * * @param nodeId - ID of the node * @returns Array of child nodes

(nodeId: string)

Source from the content-addressed store, hash-verified

718 * @returns Array of child nodes
719 */
720 getChildren(nodeId: string): Node[] {
721 const containsEdges = this.queries.getOutgoingEdges(nodeId, ['contains']);
722 if (containsEdges.length === 0) return [];
723
724 // Batch-fetch (was N+1).
725 const childNodes = this.queries.getNodesByIds(containsEdges.map((e) => e.target));
726 const children: Node[] = [];
727 for (const edge of containsEdges) {
728 const childNode = childNodes.get(edge.target);
729 if (childNode) children.push(childNode);
730 }
731 return children;
732 }
733}

Callers 2

buildContainerOutlineMethod · 0.45
getContextMethod · 0.45

Calls 3

getNodesByIdsMethod · 0.80
getMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected