static int [ ] rank ( final int [ ] [ ] g ) { final int ord = g . length ; final int [ ] count = new int [ ord + 1 ] ; final int [ ] rank = new int [ ord ] ; // frequency of each degree for ( int v = 0 ; v < ord ; v ++ ) count [ g [ v ] . length + 1 ] ++ ; // cumulated counts for ( int i = 0 ; count [ i ] < ord ; i ++ ) count [ i + 1 ] += count [ i ] ; // store sorted position of each vertex for ( int v = 0 ; v < ord ; v ++ ) rank [ v ] = count [ g [ v ] . length ] ++ ; return rank ; }
Compute a rank for each vertex . This rank is based on the degree and indicates the position each vertex would be in a sorted array .