diff --git a/admin.html b/admin.html index 259d7b1..7afbe81 100644 --- a/admin.html +++ b/admin.html @@ -1346,10 +1346,24 @@ function renderIntelGraph() { // deep-copy so d3 doesnt mutate our stored arrays on re-render const nodesCopy = nodes.map(n => ({ ...n })); - const linksCopy = links.map(l => ({ + + // merge parallel edges (same src+tgt pair) into one — concat labels, take max count + const edgeMap = new Map(); + for (const l of links) { + const src = typeof l.source === 'object' ? l.source.key : l.source; + const tgt = typeof l.target === 'object' ? l.target.key : l.target; + const key = `${src}||${tgt}`; + if (edgeMap.has(key)) { + const existing = edgeMap.get(key); + if (!existing.types.includes(l.type)) existing.types.push(l.type); + existing.count = Math.max(existing.count, l.count || 1); + } else { + edgeMap.set(key, { source: src, target: tgt, types: [l.type], count: l.count || 1 }); + } + } + const linksCopy = Array.from(edgeMap.values()).map(l => ({ ...l, - source: typeof l.source === 'object' ? l.source.key : l.source, - target: typeof l.target === 'object' ? l.target.key : l.target, + type: l.types.join(' · '), })); const svgEl = document.getElementById('intel-graph-svg');