强制定向制图 [英] Force-directed graphing
问题描述
我试图写一个图形应用程序我建立了自己的一份力量,引导或强制寰code基地。这里是什么,我试图一个例子: http://sawamuland.com/flash/graph.html
I'm trying to write a force-directed or force-atlas code base for a graphing application I'm building for myself. Here is an example of what I'm attempting: http://sawamuland.com/flash/graph.html
我设法找到一些伪code来完成我想在维基强制图谱的文章。我该转换成的ActionScript 3.0 code,因为它是一个Flash应用程序。下面是我的源:
I managed to find some pseudo code to accomplish what I'd like on the Wiki Force-atlas article. I've converted this into ActionScript 3.0 code since it's a Flash application. Here is my source:
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;
}
现在的问题是找到伪code或函数来执行库仑斥力和胡克的吸引力code。我不完全知道如何做到这一点。
The problem now is finding pseudo code or a function to perform the the coulomb repulsion and hooke attraction code. I'm not exactly sure how to accomplish this.
有谁知道一个很好的参考,我可以看看......理解和执行迅速?
Does anyone know of a good reference I can look at...understand and implement quickly?
最好的。
推荐答案
有链接到这些在同一篇文章。 虎克是一个链接的终端节点之间的弹簧力,而库仑力的排斥邻近节点了。
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.
现在的问题是不是真正的EX pressions,但应用在他们里面的常量。我会读的原创文章,谷歌的Fruchterman,颞下颌关节,和放大器;莱因戈尔德,EM(1991),图形图像被强制定向安置软件:。实践与经验,21(11)的和阅读的PDF,看看这组作者提出。
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.
这篇关于强制定向制图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!