Force-directed graphing

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2009-09-29T19:25:45Z Indexed on 2010/04/11 5:03 UTC
Read the original article Hit count: 656

Filed under:
|
|

Hello,

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

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;
}

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?

Best.

© Stack Overflow or respective owner

Related posts about graphing

Related posts about math