Starting from this example http://bl.ocks.org/1062288 I would like to have a tree with all the nodes collapsed, so the initial graph should contain only one node (the root).
var allnode = flatten(root); for (var i=0;i
for those still looking for it, here is 2 lines of code. compact and easy to understand.