Reputation: 15494
I have network and each node has a property group obtained by a clustering method. I would like to know what is the best method to render a network with the force layout where nodes belonging to the same group are gathered in space?
One way, but i don't know how to implement it, would be to add a attractive force between nodes of the same group (little compared to the repulsive force applied to all nodes).
Upvotes: 3
Views: 1720
Reputation: 15494
one possibility is to devide space in nb_group
directions and push nodes in the direction allocated to their group:
var angle = 2*Math.PI/nb_group;
var intensity = 500;
var updateNode = function() {
this.attr("transform", function(d) {
var xm = d.x + intensity*Math.cos(angle*d.group);
var ym = d.y + intensity*Math.sin(angle*d.group);
return "translate(" + xm + "," + ym + ")";
});
}
my intensity
is hugh because I have charge of 1000
Upvotes: 4