| 676 | const site = (e: Edge) => `${e.source}|${e.target}|${e.kind}|${e.line ?? -1}|${e.column ?? -1}`; |
| 677 | const of = (list: Edge[]) => (opts.edgeKinds.length > 0 ? list.filter((e) => opts.edgeKinds.includes(e.kind)) : list); |
| 678 | const adjacent = (id: string): Edge[] => { |
| 679 | const out = of(edges.filter((e) => e.source === id)); |
| 680 | const into = of(edges.filter((e) => e.target === id)); |
| 681 | return opts.direction === 'outgoing' ? out : opts.direction === 'incoming' ? into : [...out, ...into]; |
| 682 | }; |
| 683 | const kept = new Map<string, Node>([[startId, byId.get(startId)!]]); |
| 684 | const keptEdges: Edge[] = []; |
| 685 | const visited = new Set<string>(); |