I am using the Force Directed Graph to build a kind of flow diagram. It works fine except that the nodes have no specific order. They are random. I would like the graph to follow a hierarchical order.
var force = d3.layout.force()
.nodes(d3.values(nodes))
.links(links)
.size([width, height])
.linkDistance(90)
.gravity(0.6)
.charge(-2000)
.linkStrength(0.3);
I want to give the nodes some (numerical) hierarchy. Not explicitly define their placement.
Any help will be appreciated.
来源:https://stackoverflow.com/questions/19293595/d3-force-directed-graph-nodes-in-order