protected void initialize ( ) { log . info ( "Building Huffman tree for source graph..." ) ; int nVertices = sourceGraph . numVertices ( ) ; //int[] degrees = new int[nVertices]; //for( int i=0; i<nVertices; i++ ) // degrees[i] = sourceGraph.getVertexDegree(i); /* for (int y = 0; y < nVertices; y+= 20) { int[] copy = Arrays.copyOfRange(degrees, y, y+20); System.out.println("D: " + Arrays.toString(copy)); } */ // GraphHuffman huffman = new GraphHuffman(nVertices); // huffman.buildTree(degrees); log . info ( "Transferring Huffman tree info to nodes..." ) ; for ( int i = 0 ; i < nVertices ; i ++ ) { T element = sourceGraph . getVertex ( i ) . getValue ( ) ; element . setElementFrequency ( sourceGraph . getConnectedVertices ( i ) . size ( ) ) ; if ( vocabCache != null ) vocabCache . addToken ( element ) ; } if ( vocabCache != null ) { Huffman huffman = new Huffman ( vocabCache . vocabWords ( ) ) ; huffman . build ( ) ; huffman . applyIndexes ( vocabCache ) ; } }
This method handles required initialization for GraphTransformer