我第一次尝试使用Mathematica并使用TunkRank作为我的首选算法.这是我想出的:
Following = {{2, 3, 4}, {0, 4}, {1, 3}, {1, 4}, {0, 2}}
Followers = {{1, 4}, {2, 3}, {0, 4}, {0, 2}, {0, 1, 3}}
p = 0.05
Influence[x_] := Influence[x] =
Sum[1 + (p * Influence[Followers[[x, i]]])/(1 +
Length[Following[[x]]]), {i, 0, Length[Followers[[x]]]}]
Run Code Online (Sandbox Code Playgroud)
如果您在Mathematica中运行它,您将看到它不仅仅在跟随节点上运行.相反,递归是无限的.我究竟做错了什么?