score:2

Accepted answer

Hopefully this will help out. From this example : How can I start with all the nodes collapsed in d3js?

I edited your fiddle : http://jsfiddle.net/thatOneGuy/yar5sco6/7/

I removed the original call to update(). So you have to press Load then Start.

This collapses all nodes. From there you can open up the first two hierarchies fairly easy :)

This is the main implementation :

//HTML

<button id='startForce'>START</button>

//JS

document.getElementById('startForce').addEventListener('click', function() {
            console.log('start');

            var nodes = flatten(root);
            nodes.forEach(function(d) {
              d._children = d.children;
              d.children = null;
            });
            update();
          })

Related Query

More Query from same tag