* 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[])
| 2918 | * from the map rather than present as 0. |
| 2919 | */ |
| 2920 | countOutgoingEdges(ids: readonly string[]): Map<string, number> { |
| 2921 | const out = new Map<string, number>(); |
| 2922 | if (ids.length === 0) return out; |
| 2923 | const unique = [...new Set(ids)]; |
| 2924 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 2925 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 2926 | const placeholders = chunk.map(() => '?').join(','); |
| 2927 | const rows = this.db |
| 2928 | .prepare( |
| 2929 | `SELECT source, COUNT(*) AS count FROM edges WHERE source IN (${placeholders}) GROUP BY source` |
| 2930 | ) |
| 2931 | .all(...chunk) as Array<{ source: string; count: number }>; |
| 2932 | for (const row of rows) out.set(row.source, row.count); |
| 2933 | } |
| 2934 | return out; |
| 2935 | } |
| 2936 | |
| 2937 | /** |
| 2938 | * Symbols nothing in the index points at — the candidate set behind the dead |