Expand/Collapse all groups

Depending on how you want to deal with any nested groups, either:

myDiagram.commit(function(d) {
    d.findTopLevelGroups().each(function(g) { g.collapseSubGraph(); });
});

Or:

myDiagram.commit(function(d) {
    d.nodes.each(function(g) {
       if (g instanceof go.Group) g.collapseSubGraph();
    });
});