private String clusterSizes(List<List<Node>> partition, List<List<Node>> trueClusters) { String s = ""; FOR: for (int i = 0; i < partition.size(); i++) { List<Node> cluster = partition.get(i); s += cluster.size(); for (List<Node> trueCluster : trueClusters) { if (trueCluster.containsAll(cluster)) { // Collections.sort(trueCluster); // Collections.sort(cluster); // System.out.println(trueCluster + " " + cluster); s += "p"; if (i < partition.size() - 1) { s += ","; } continue FOR; } } if (i < partition.size() - 1) { s += ","; } } return s; }
private boolean containsImpureCluster(List<List<Node>> partition, List<List<Node>> trueClusters) { FOR: for (int i = 0; i < partition.size(); i++) { List<Node> cluster = partition.get(i); for (List<Node> trueCluster : trueClusters) { if (trueCluster.containsAll(cluster)) { continue FOR; } } return true; } return false; }