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

Method findEdgesBetweenNodes

src/db/queries.ts:3618–3632  ·  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

3616 * Useful for recovering inter-node connectivity after BFS.
3617 */
3618 findEdgesBetweenNodes(nodeIds: string[], kinds?: EdgeKind[]): Edge[] {
3619 if (nodeIds.length === 0) return [];
3620
3621 const idsJson = JSON.stringify(nodeIds);
3622 let sql = `SELECT * FROM edges WHERE source IN (SELECT value FROM json_each(?)) AND target IN (SELECT value FROM json_each(?))`;
3623 const params: string[] = [idsJson, idsJson];
3624
3625 if (kinds && kinds.length > 0) {
3626 sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`;
3627 params.push(...kinds);
3628 }
3629
3630 const rows = this.db.prepare(sql).all(...params) as EdgeRow[];
3631 return rows.map(rowToEdge);
3632 }
3633
3634 /**
3635 * 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