Does anyone have either a Xojo snippet or complete pseudo code for the “Directed Force” algorithm to layout a series of connected nodes?
my node class is (simple)
classNODE
id as integer
caption as string
location as realbasic.point
size as realbasic.size
connections(-1) as integer
where
id is a unique value to distinguish this node
and caption would be a simple label to be drawn at “location” in a rectangle of "size’
and the connections array is the ID of 0 to n other classNode objects to which this one is “connected”
Given an array of such nodes, I need to apply an algorithm to adjust the location of each node for a “reasonable” starting layout
The user will then have the option to drag the nodes around as they see fit… but I need something other than a “random” starting layout
All the discussions I have found about “Directed Force” are theoretical , or engineered to a more complex data model than this