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

Method findEdgesBetweenNodes

src/db/queries.ts:3722–3736  ·  view source on GitHub ↗

* Find all edges where both source and target are in the given node set. * Useful for recovering inter-node connectivity after BFS.

(nodeIds: string[], kinds?: EdgeKind[])

Source from the content-addressed store, hash-verified

3720 * Useful for recovering inter-node connectivity after BFS.
3721 */
3722 findEdgesBetweenNodes(nodeIds: string[], kinds?: EdgeKind[]): Edge[] {
3723 if (nodeIds.length === 0) return [];
3724
3725 const idsJson = JSON.stringify(nodeIds);
3726 let sql = `SELECT * FROM edges WHERE source IN (SELECT value FROM json_each(?)) AND target IN (SELECT value FROM json_each(?))`;
3727 const params: string[] = [idsJson, idsJson];
3728
3729 if (kinds && kinds.length > 0) {
3730 sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`;
3731 params.push(...kinds);
3732 }
3733
3734 const rows = this.db.prepare(sql).all(...params) as EdgeRow[];
3735 return rows.map(rowToEdge);
3736 }
3737
3738 /**
3739 * Distinct file paths that DEPEND ON `filePath`: every file containing a

Callers 1

findRelevantContextMethod · 0.80

Calls 5

mapMethod · 0.80
pushMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected