Question for non-standard force layout model #157
-
Hello I am trying to make a force layout simulation that displays the graph in a tree like way. By "tree-like", I mean I want the resulting layout to look something like a hierarchical layout where parent nodes will be displayed above child nodes, left child nodes are placed to the left of their sibling nodes, etc. These aren't hard constraints, but I want the layout to trend towards local placements close to this:
I don't want to use Sugiyama because it is complicated to turn that into an incremental algorithm (nodes in my visualization will be continually added and removed). My main idea right now is to coarsen the graph by treating some of the local 3-node subgraphs (parent, leftChild, rightChild) as single nodes, and applying a force simulation on that simplified graph. Maybe even treating 2-node subgraphs of (parent, leftChild) as single nodes would be enough. Is there a more elegant/simple approach? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I'm not sure why the Hierarchy module doesn't fit your needs? The main way you can mess with force layouts is that after each tick you can change the positions and velocities manually. So you could enforce further constraints, such as making a parent node have a lower y value than a child node for instance. Another trick worth keeping in mind is that links in a force simulation don't have to correspond 1-1 with links that you draw on the screen. So for instance adding an extra invisible link between |
Beta Was this translation helpful? Give feedback.
I'm not sure why the Hierarchy module doesn't fit your needs?
The main way you can mess with force layouts is that after each tick you can change the positions and velocities manually. So you could enforce further constraints, such as making a parent node have a lower y value than a child node for instance.
Another trick worth keeping in mind is that links in a force simulation don't have to correspond 1-1 with links that you draw on the screen. So for instance adding an extra invisible link between
leftChild
andrightChild
will make it quite likely that you will end up with a triangular looking layout between the three.