0

我正在尝试为我为自己构建的图形应用程序编写强制导向或强制图集代码库。这是我正在尝试的一个示例:http: //sawamuland.com/flash/graph.html

我设法找到了一些伪代码来完成我想要的 Wiki Force-atlas 文章。因为它是一个 Flash 应用程序,所以我已将它转换为 ActionScript 3.0 代码。这是我的来源:

var timestep:int = 0;
var damping:int  = 0;
var total_kinetic_engery:int = 0;

for (var node in list) {
 var net_force:int = 0;
 for (var other_node in list) {
  net_force += coulombRepulsion(node, other_node, nodeList);
 }
 for (var spring in list[node].relations) {
  net_force += hookeAttraction(node, spring, nodeList);
 }
 list[node].velocity += (timestep * net_force) * damping;
 list[node].position += timestep * list[node].velocity;
 total_kinetic_engery += list[node].mass * (list[node].velocity) ^ 2;
}

现在的问题是找到伪代码或函数来执行库仑斥力和胡克引力代码。我不完全确定如何做到这一点。

有谁知道我可以查看的很好的参考资料...快速理解和实施?

最好的。

4

2 回答 2

1

There are links to these in the same article. Hooke's is the spring force between end-nodes of a link, while Coulomb's force repels nearby nodes away.

The question is not really the expressions, but the constants applied inside them. I would read the original article, google for "Fruchterman, T. M. J., & Reingold, E. M. (1991). Graph Drawing by Force-Directed Placement. Software: Practice and Experience, 21(11)." and read through the pdf to see what the authors suggest.

Btw, your vars may have to be floats, not integers.

于 2009-09-29T19:54:26.850 回答
0

你看过耀斑吗?有一个带有力导向图的演示。

于 2010-08-30T22:16:52.477 回答