Skip to content

A Simple and Universal Swarm Intelligence Engine, Predicting Anything. 简洁通用的群体智能引擎,预测万物

Add gravitational forces to node simulation in GraphPanel.vue

666ghj1f6f79c8aa1b
diff --git a/frontend/src/components/GraphPanel.vue b/frontend/src/components/GraphPanel.vue
index 539ebff0..767f8d18 100644
--- a/frontend/src/components/GraphPanel.vue
+++ b/frontend/src/components/GraphPanel.vue
@@ -440,6 +440,9 @@ const renderGraph = () => {
.force('charge', d3.forceManyBody().strength(-400))
.force('center', d3.forceCenter(width / 2, height / 2))
.force('collide', d3.forceCollide(50))
+ // 添加向中心的引力,让独立的节点群聚集到中心区域
+ .force('x', d3.forceX(width / 2).strength(0.04))
+ .force('y', d3.forceY(height / 2).strength(0.04))
currentSimulation = simulation