private void refine ( PermutationGroup group , Partition coarser ) { int vertexCount = getVertexCount ( ) ; Partition finer = equitableRefiner . refine ( coarser ) ; int firstNonDiscreteCell = finer . getIndexOfFirstNonDiscreteCell ( ) ; if ( firstNonDiscreteCell == - 1 ) { firstNonDiscreteCell = vertexCount ; } Permutation pi1 = new Permutation ( firstNonDiscreteCell ) ; Result result = Result . BETTER ; if ( bestExist ) { pi1 = finer . setAsPermutation ( firstNonDiscreteCell ) ; result = compareRowwise ( pi1 ) ; } // partition is discrete if ( finer . size ( ) == vertexCount ) { if ( ! bestExist ) { best = finer . toPermutation ( ) ; first = finer . toPermutation ( ) ; bestExist = true ; } else { if ( result == Result . BETTER ) { best = new Permutation ( pi1 ) ; } else if ( result == Result . EQUAL ) { group . enter ( pi1 . multiply ( best . invert ( ) ) ) ; } } } else { if ( result != Result . WORSE ) { Set < Integer > blockCopy = finer . copyBlock ( firstNonDiscreteCell ) ; for ( int vertexInBlock = 0 ; vertexInBlock < vertexCount ; vertexInBlock ++ ) { if ( blockCopy . contains ( vertexInBlock ) ) { Partition nextPartition = finer . splitBefore ( firstNonDiscreteCell , vertexInBlock ) ; this . refine ( group , nextPartition ) ; int [ ] permF = new int [ vertexCount ] ; int [ ] invF = new int [ vertexCount ] ; for ( int i = 0 ; i < vertexCount ; i ++ ) { permF [ i ] = i ; invF [ i ] = i ; } for ( int j = 0 ; j <= firstNonDiscreteCell ; j ++ ) { int x = nextPartition . getFirstInCell ( j ) ; int i = invF [ x ] ; int h = permF [ j ] ; permF [ j ] = x ; permF [ i ] = h ; invF [ h ] = i ; invF [ x ] = j ; } Permutation pPermF = new Permutation ( permF ) ; group . changeBase ( pPermF ) ; for ( int j = 0 ; j < vertexCount ; j ++ ) { Permutation g = group . get ( firstNonDiscreteCell , j ) ; if ( g != null ) { blockCopy . remove ( g . get ( vertexInBlock ) ) ; } } } } } } }
Does the work of the class that refines a coarse partition into a finer one using the supplied automorphism group to prune the search .