/** Generate the hierarchical cluster and display it as a denogram in the graph */ public TreeNode makeTree(ClutoSolution cs) { int[] tsize = cs.getTreeCounts(); int[][] ftree = cs.getForwardTree(); int nnrows = tsize.length; int nrows = cs.getMatrix().getRowCount(); // for (int i = 0; i < nnrows-1; i++) { // String s = "ftree" + "\t" + i + "\t" + ftree[i][0] + "\t" + ftree[i][1] + "\t" + tsize[i]; // System.out.println(s); // } Cluster[] ca = new Cluster[nnrows]; for (int i = 0; i < nnrows - 1; i++) { if (!true) { String s = "ftree" + "\t" + i + "\t" + ftree[i][0] + "\t" + ftree[i][1] + "\t" + tsize[i]; System.out.println(s); } Cluster cn = i < nrows ? (Cluster) new RowCluster(tm, i, null) : new CompositeCluster(); cn.setSimilarity(Math.abs(tsize[i])); ca[i] = cn; if (ftree[i][0] > -1) { cn.add(ca[ftree[i][0]]); } if (ftree[i][0] > -1) { cn.add(ca[ftree[i][1]]); } rootNode = cn; } return rootNode; }