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

Method getAdjacentEdges

src/graph/traversal.ts:235–252  ·  view source on GitHub ↗

* Get adjacent edges based on direction

(
    nodeId: string,
    direction: 'outgoing' | 'incoming' | 'both',
    edgeKinds?: EdgeKind[]
  )

Source from the content-addressed store, hash-verified

233 * Get adjacent edges based on direction
234 */
235 private getAdjacentEdges(
236 nodeId: string,
237 direction: 'outgoing' | 'incoming' | 'both',
238 edgeKinds?: EdgeKind[]
239 ): Edge[] {
240 const kinds = edgeKinds && edgeKinds.length > 0 ? edgeKinds : undefined;
241
242 if (direction === 'outgoing') {
243 return this.queries.getOutgoingEdges(nodeId, kinds);
244 } else if (direction === 'incoming') {
245 return this.queries.getIncomingEdges(nodeId, kinds);
246 } else {
247 // Both directions
248 const outgoing = this.queries.getOutgoingEdges(nodeId, kinds);
249 const incoming = this.queries.getIncomingEdges(nodeId, kinds);
250 return [...outgoing, ...incoming];
251 }
252 }
253
254 /**
255 * Find all callers of a function/method

Callers 2

traverseBFSMethod · 0.95
dfsRecursiveMethod · 0.95

Calls 2

getOutgoingEdgesMethod · 0.45
getIncomingEdgesMethod · 0.45

Tested by

no test coverage detected