protected final boolean passesHavelHakimiTest() {
        MutableDegreeDistribution copy = new MutableSimpleDegreeDistribution(getDegrees());

        int i = 0;
        int first;
        int L = this.size();

        while (L > 0) {
            first = copy.get(i);
            L--;

            int j = 1;
            for (int k = 0; k < first; ++k) {
                while (copy.get(j) == 0) {

                    j++;
                    if (j > L) {
                        return false;
                    }
                }

                copy.set(j, copy.get(j) - 1);
            }

            copy.set(i, 0);
            copy.sort(Collections.<Integer>reverseOrder());
        }

        return true;
    }
protected final boolean passesHavelHakimiTest ( ) { MutableDegreeDistribution copy = new MutableSimpleDegreeDistribution ( getDegrees ( ) ) ; int i = 0 ; int first ; int L = this . size ( ) ; while ( L > 0 ) { first = copy . get ( i ) ; L -- ; int j = 1 ; for ( int k = 0 ; k < first ; ++ k ) { while ( copy . get ( j ) == 0 ) { j ++ ; if ( j > L ) { return false ; } } copy . set ( j , copy . get ( j ) - 1 ) ; } copy . set ( i , 0 ) ; copy . sort ( Collections . < Integer > reverseOrder ( ) ) ; } return true ; }
Havel-Hakimi is a recursive alternative to the Erdos-Gallai condition. This is a looped implementation, the
algorithm is recursive in nature, but recursion is slower.
<p/>
Kept as a backup, might be useful as a replacement for E-G eventually.

@return true iff passes.