* Fan-out (total outgoing edge count) for MANY nodes in one query — the * mirror of countIncomingEdges. Ids with no outgoing edges are absent * from the map rather than present as 0.
(ids: readonly string[])
| 2884 | * from the map rather than present as 0. |
| 2885 | */ |
| 2886 | countOutgoingEdges(ids: readonly string[]): Map<string, number> { |
| 2887 | const out = new Map<string, number>(); |
| 2888 | if (ids.length === 0) return out; |
| 2889 | const unique = [...new Set(ids)]; |
| 2890 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 2891 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 2892 | const placeholders = chunk.map(() => '?').join(','); |
| 2893 | const rows = this.db |
| 2894 | .prepare( |
| 2895 | `SELECT source, COUNT(*) AS count FROM edges WHERE source IN (${placeholders}) GROUP BY source` |
| 2896 | ) |
| 2897 | .all(...chunk) as Array<{ source: string; count: number }>; |
| 2898 | for (const row of rows) out.set(row.source, row.count); |
| 2899 | } |
| 2900 | return out; |
| 2901 | } |
| 2902 | |
| 2903 | /** |
| 2904 | * Symbols nothing in the index points at — the candidate set behind the dead |