159160161162163164165166
String s3 = m2.group(3); nodes.get(s1).connect(nodes.get(s2), s3); } } return new ClusterHead(g); }
5556575859606162636465
//foo bar baz public abstract class SILReader { public static ClusterHead clusterTreeBySIL(Graph g, File input) throws IOException { ClusterHead ret = new ClusterHead(g); BufferedReader in = new BufferedReader(new FileReader(input)); String line;
35363738394041424344454647484950515253
if(n != n2) n.connect(n2, ""); } } goodTree = new ClusterHead(); for(Node n: g.getNodes()){ ClusterNode cn = new ClusterNode(); cn.addNode(n); goodTree.addChild(cn); } badTree = new ClusterHead(); for(Node n: g.getNodes()){ ClusterNode cn = new ClusterNode(); cn.addNode(n); badTree.addChild(cn);
2021222324252627282930313233
"\n}"; } @Test public void testBasic(){ ClusterHead tree = null; try{ tree = TreeLoader.loadTreeFromDot("/Users/mat/Documents/graphs/pump.dot"); }catch(Exception e){ fail("boo" +e); } ClusterUtils.prettyPrintTree(tree); System.out.println(tree.getCluster()); }
6768697071727374757677
} @Test public void testOneSmallerComponentOneTreeLevel(){ goodTree = new ClusterHead(); ClusterNode mainThree = new ClusterNode(); mainThree.addNode(nodes.get(0)); mainThree.addNode(nodes.get(1)); mainThree.addNode(nodes.get(2));
8788899091929394959697
testAreSame(); } @Test public void testTwoOneElementClustersOneLevel(){ goodTree = new ClusterHead(); ClusterNode c1 = new ClusterNode(); c1.addNode(nodes.get(0)); c1.addNode(nodes.get(1));
110111112113114115116117118119120
testAreSame(); } @Test public void testTwoLevelClustersUnbalanced(){ goodTree = new ClusterHead(); ClusterNode c1 = new ClusterNode(); c1.addNode(nodes.get(0)); c1.addNode(nodes.get(1));
137138139140141142143144145146147
testAreSame(); } @Test public void twoLevelBalancedClusters(){ goodTree = new ClusterHead(); ClusterNode c1 = new ClusterNode(); c1.addNode(nodes.get(0)); c1.addNode(nodes.get(1));