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

Function edgesOf

__tests__/sync-python-import-binding-retry.test.ts:184–193  ·  view source on GitHub ↗

Every edge, by its ends' natural keys, with where it is written and how it resolved.

(graph: CodeGraph)

Source from the content-addressed store, hash-verified

182
183/** Every edge, by its ends' natural keys, with where it is written and how it resolved. */
184function edgesOf(graph: CodeGraph): string[] {
185 const keys = new Map(
186 graph.getFiles()
187 .flatMap((file) => graph.getNodesInFile(file.path))
188 .map((n) => [n.id, `${n.kind} ${n.filePath}:${n.qualifiedName}:${n.startLine}`] as const)
189 );
190 return graph.getOutgoingEdgesFrom([...keys.keys()])
191 .map((e) => `${e.kind} ${keys.get(e.source)} -> ${keys.get(e.target) ?? e.target} @${e.line}:${e.column} ${JSON.stringify(e.metadata ?? {})}`)
192 .sort();
193}
194
195/** The links of `expected`'s reference names the graph has ({@link LINKS} by default). */
196function linksOf(graph: CodeGraph, expected: string[] = LINKS): string[] {

Callers 2

fullIndexOfFunction · 0.70

Calls 5

mapMethod · 0.80
getFilesMethod · 0.80
getNodesInFileMethod · 0.65
getMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected