Force in a box is A d3.js force extension that implements the Group-in-a-box layout algorithm to distribute nodes in a network according to their clusters. The algorithm uses a treemap to compute focis that are later used to distribute each cluster into it's own box.
To use it you need to include the library, and use the forceInABox instead of the normal d3.layout.force
<script type="text/javascript" src="forceInABox.js"> </script>
//create the force and specify the grouping parameter
var force = d3.layout.forceInABox()
.groupBy("group");
//Add nodes and edges
force.nodes(nodes)
.edges(edges)
.start();
//Add the onTick method to the tick event
force.on("tick", function(e) {
force.onTick(e);
};
forked from john-guerra's block: Force in a Box algorithm
Updated missing url https://cdn.rawgit.com/john-guerra/forceInABox/master/forceInABox.js to https://cdn.jsdelivr.net/gh/john-guerra/forceinabox/forceinabox.js
https://d3js.org/d3.v3.min.js
https://cdn.rawgit.com/john-guerra/forceInABox/master/forceInABox.js