Not sure if I’m using the right terminology so this question may already be answered somewhere on stackoverflow (if so, please let me know). Is there a way to designate multiple “gravity points” in a d3.js graph where the gravity point is one node with a fixed (x,y) value in each cluster? For example, I’m using the code from this example to display clusters. The only difference in what my graphs will look like is that the nodes will have links to each other (possibly to nodes in other clusters as well). I want to make sure the other clusters overlap as little as possible and still show any links between each cluster.
I’ve tried force.gravity(0.1) with force.charge(-10). That seems to keep the clusters apart but the between-cluster distance continues to decrease as gravity increase because there is only one “gravity point” located in the middle of the graph by default.
Only way i can think of is to add a node where you want to keep gravity and designate its charge with a large positive value , rest of the nodes should have a negative value charge. Hopefully they will attract towards each other. If you have found a better solution , please let me know.