fix large entity

This commit is contained in:
overcuriousity
2025-09-13 16:09:10 +02:00
parent 612f414d2a
commit 717f103596
3 changed files with 47 additions and 18 deletions

View File

@@ -270,24 +270,50 @@ class GraphManager {
this.initialize();
}
// Find all aggregated node IDs first
const aggregatedNodeIds = new Set();
const largeEntityMap = new Map();
graphData.nodes.forEach(node => {
if (node.type === 'large_entity' && node.metadata && Array.isArray(node.metadata.nodes)) {
node.metadata.nodes.forEach(nodeId => aggregatedNodeIds.add(nodeId));
node.metadata.nodes.forEach(nodeId => {
largeEntityMap.set(nodeId, node.id);
});
}
});
// Process nodes, hiding the ones that are aggregated
const processedNodes = graphData.nodes.map(node => {
const processed = this.processNode(node);
if (aggregatedNodeIds.has(node.id)) {
processed.hidden = true; // Mark node as hidden
if (largeEntityMap.has(node.id)) {
processed.hidden = true;
}
return processed;
});
const mergedEdges = {};
graphData.edges.forEach(edge => {
const fromNode = largeEntityMap.has(edge.from) ? largeEntityMap.get(edge.from) : edge.from;
const mergeKey = `${fromNode}-${edge.to}-${edge.label}`;
if (!mergedEdges[mergeKey]) {
mergedEdges[mergeKey] = {
...edge,
from: fromNode,
count: 0,
confidence_score: 0
};
}
mergedEdges[mergeKey].count++;
if (edge.confidence_score > mergedEdges[mergeKey].confidence_score) {
mergedEdges[mergeKey].confidence_score = edge.confidence_score;
}
});
const processedEdges = Object.values(mergedEdges).map(edge => {
const processed = this.processEdge(edge);
if (edge.count > 1) {
processed.label = `${edge.label} (${edge.count})`;
}
return processed;
});
const processedEdges = graphData.edges.map(edge => this.processEdge(edge));
// Update datasets with animation
const existingNodeIds = this.nodes.getIds();
@@ -457,7 +483,7 @@ class GraphManager {
'ip': 14,
'asn': 16,
'correlation_object': 8,
'large_entity': 12
'large_entity': 5
};
return sizes[nodeType] || 12;
}