private static void visitNode(Group node, List<Group> leaves) {
        if (node.isLeafGroup()) {
            leaves.add(node);
        } else {
            node.getSubgroups().forEach((idx, g) -> visitNode(g, leaves));
        }
    }
Return a list of all groups that do not themselves have any child groups,
i.e. only the groups that contain nodes.

The output order is not defined.
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/LeafGroups.java