- commit
- 318f967
- parent
- 12af7eb
- author
- im_wower
- date
- 2026-04-01 11:59:07 +0800 CST
integration phase2.4: circulation净流+加权度归一化 (Gemini TOPO-001+MATH-001)
2 files changed,
+11,
-6
+5,
-3
1@@ -51,9 +51,11 @@ class Dynamics:
2 for node_id in self.graph.nodes:
3 lap = self.graph.laplacian_at(node_id, phi)
4 asym = self.graph.asymmetry_at(node_id, phi)
5- # 按节点度归一化,防止高权重累积放大
6- degree = len(self.graph.neighbors_all(node_id))
7- norm = max(degree, 1)
8+ # 按加权度归一化(Gemini MATH-001 修复)
9+ # 用出入边权重绝对值之和,而非拓扑连接数
10+ fwd_w = sum(abs(e.weight) for e in self.graph.fwd_edges.get(node_id, {}).values())
11+ bwd_w = sum(abs(e.weight) for e in self.graph.bwd_edges.get(node_id, {}).values())
12+ norm = max(fwd_w + bwd_w, 1e-10)
13 phi_v = phi.get(node_id, 0.0)
14 new_phi[node_id] = (
15 phi_v
+6,
-3
1@@ -192,15 +192,18 @@ class Graph:
2
3 def circulation(self, path: list[str]) -> float:
4 """
5- 计算闭合路径的环流 Σ J(u,v)。
6- 非零环流 = 旋度 ≠ 0 = 技能/极限环。
7+ 计算闭合路径的净环流 Σ (W_fwd - W_bwd)。
8+ 净流 ≠ 0 = 旋度 ≠ 0 = 技能/极限环。
9+ 对称图上净环流恒为零——只有非对称权重才产生旋度。
10 path 应为闭合的:[a, b, c, a]
11 """
12 if len(path) < 2:
13 return 0.0
14 total = 0.0
15 for i in range(len(path) - 1):
16- total += self.get_edge_weight(path[i], path[i + 1])
17+ fwd = self.get_edge_weight(path[i], path[i + 1]) # A→B 正向权重
18+ bwd = self.get_bwd_weight(path[i + 1], path[i]) # A→B 反向权重(bwd_edges[B][A])
19+ total += fwd - bwd # 净流:正向减反向
20 return total
21
22 # ── 路径汇聚度 κ ──