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