private static TreeMap<String, GroupNodes> enumerateGroupNodes(DistributionConfigBundle cfg) {
        var groups = new TreeMap<String, GroupNodes>();
        // Config is already in flattened form for groups, so use it directly.
        for (var g : cfg.config().group()) {
            // Use group "index" as name, as it encodes the group hierarchy as a dotted string path.
            // "invalid" is the fixed index string value of the root group. If the root group contains
            // any nodes at all, there will not be any nested groups by definition, as only leaf groups
            // may contain nodes.
            String name = "invalid".equals(g.index()) ? "root group" : "group %s".formatted(g.index());
            groups.put(name, new GroupNodes(g.nodes().stream().map(n -> n.index()).collect(Collectors.toSet())));
        }
        return groups;
    }
Utility for computing a "minimal" diff between two arbitrary distribution configs.
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/DistributionDiffCalculator.java