From 2ed5cdce5e25e517d5aa4d22fad788ba82da2f08 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sat, 22 Mar 2025 14:49:04 +0800 Subject: [PATCH] Update the node size of the expanded node --- lightrag_webui/src/hooks/useLightragGraph.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lightrag_webui/src/hooks/useLightragGraph.tsx b/lightrag_webui/src/hooks/useLightragGraph.tsx index 6c54ec2e..c2c8f7b8 100644 --- a/lightrag_webui/src/hooks/useLightragGraph.tsx +++ b/lightrag_webui/src/hooks/useLightragGraph.tsx @@ -685,6 +685,17 @@ const useLightrangeGraph = () => { // Update sizes for all nodes with discarded edges updateNodeSizes(sigmaGraph, nodesWithDiscardedEdges, minDegree, maxDegree); + if (sigmaGraph.hasNode(nodeId)) { + const finalDegree = sigmaGraph.degree(nodeId); + const limitedDegree = Math.min(finalDegree, maxDegree + 1); + const newSize = Math.round( + Constants.minNodeSize + scale * Math.pow((limitedDegree - minDegree) / range, 0.5) + ); + sigmaGraph.setNodeAttribute(nodeId, 'size', newSize); + nodeToExpand.size = newSize; + nodeToExpand.degree = finalDegree; + } + } catch (error) { console.error('Error expanding node:', error); }