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

Function edgeBetween

src/ui-server/api/flow.ts:627–643  ·  view source on GitHub ↗

* The edge that already connects two symbols the reader walked between. * * A trail is not searched — the hops are given — so all that is missing is * which recorded edge the reader crossed. A `down` hop is a call out of the * previous symbol; an `up` hop is the same edge read backwards, which i

(
  cg: CodeGraph,
  from: Node,
  to: Node
)

Source from the content-addressed store, hash-verified

625 * `upward` exists and why the link says "called by" rather than "calls".
626 */
627function edgeBetween(
628 cg: CodeGraph,
629 from: Node,
630 to: Node
631): { edge: Edge; upward: boolean } | null {
632 let best: Edge | null = null;
633 for (const { node, edge } of cg.getCallees(from.id)) {
634 if (node.id !== to.id) continue;
635 if (best === null || (edge.kind === 'calls' && best.kind !== 'calls')) best = edge;
636 }
637 if (best) return { edge: best, upward: false };
638 for (const { node, edge } of cg.getCallers(from.id)) {
639 if (node.id !== to.id) continue;
640 if (best === null || (edge.kind === 'calls' && best.kind !== 'calls')) best = edge;
641 }
642 return best ? { edge: best, upward: true } : null;
643}
644
645function ambiguitiesOf(
646 tokenNodes: ReadonlyMap<string, string[]>,

Callers 1

buildFlowFunction · 0.85

Calls 2

getCalleesMethod · 0.45
getCallersMethod · 0.45

Tested by

no test coverage detected