# Force Directed graphs - visualising complex networks in space

What are the best approaches to making force directed graphs in VVVV?
Are there any public public example patches anyone has made?

Here are some examples for those who are unfamiliar:
Mathematic examples of force directed graphs
http://reference.wolfram.com/mathematica/tutorial/GraphDrawingIntroduction.html (wolfram Research)
processing examples
http://www.cricketschirping.com/weblog/2005/12/11/force-directed-graph-layout-with-proce55ing/ (banksean)
http://www.cricketschirping.com/processing/GraphLayout/ (banksean)
http://www.openprocessing.org/visuals/?visualID=177 (Lorenzo Marchi
)

o-O=O-o

To clarify: who has advice for the basics (i.e. a starting point) in patching such things in a 3D space

hey john,

i have not implemented anything like that yet, but i’d guess a good starting point would be to build a spread of coordinates for the entities of the system and use a basic line-(ex9) node to draw the connections in a renderer-(ex9).
if you have that running you could replace the line-(ex9) with something like woei’s very nice CurveSimple.fx from the old vvvv site.

thanks m4d, I’m playing around with how i will render the resultant spread of coordinates now.
The core issue for me right now is how to go about generating those coordinates from an initial set of data that is a list of entities and their respective connections.
From my understanding I would also generate some random starting locations and then let the algorithm find equilibrium.
This algorithm will continually move those initial coordinates until there is a balance (within computational reasonableness) to locations that are balanced between the forces of repulsion between the entities and the forces of attraction along the connections.
It is my hope that someone has some advice that will give me a starting point in patching this core mechanism. (sounds very mechanical and physical, doesn’t it;))
Thanks again and I will look at CurveSimple.fx
J

you could try the CreateDistanceJoint (Box2D) node to get the force part going…

could be good, I just loaded the help patch (CreateDistanceJoint) and it is missing nodes and connections, so I can’t quite work out how to reconnect the help patch to see how it works!! (had this prob with a few help patches) Maybe this will only be useful for a fixed distance ??? will try in the Morning (I’m in OZ, must sleep. Its great to have some help, keep the ideas flowing and I’ll try to get a patch up ASAP to give my question some more context.

fibo put in a shotbox (20:05, 04.08.10):
“wow, I think ConnectAll (3d) could
be usefull for draw directed graphs.”
I wonder if this is useful in this topic

this simple file has some spheres with random connections, if any one has some suggestions how to implement a spring electric algorithm here I would be happy to learn

spring electric net_v01.v4p (11.1 kB)

After pulling my finger out and trying a bit harder here is my patch as is … probably a few bugs in there, but it is working.
I am sure many people have done this before, so please comment on my approach compared to yours.
For those for whom this is new: Feel free to use, abuse, and send your feedback advice.

OPEN: NET3_v01.v4p
John

NET 3.zip (15.5 kB)

sorry, i was out of town for a few days. congrats on solving the problem!

impressive patch, but as for performance reasons this would be better implemented as textual code, here is a plugin: force-directed-graph