* 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[])
| 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 |