anchor.diff:      integer(kind=kint), parameter :: NMINMAX = 5
       integer(kind=kint) :: i, nmin
       integer(kind=kint) :: mins(NMINMAX)
  +    integer(kind=kint), allocatable :: degs(:)
       integer(kind=kint), allocatable :: nlevel(:)
       integer(kind=kint), allocatable :: lv_index(:,:), lv_item(:,:)
       integer(kind=kint) :: nlevel_max, max_id
  -    call find_minimum_degrees(N, indexL, indexU, itemU, NMINMAX, nmin, mins)
  +    allocate(degs(N))
  +    call count_degrees(N, indexL, indexU, itemU, degs)
  +    call find_minimum_degrees(N, degs, NMINMAX, nmin, mins)
       allocate(nlevel(nmin), lv_index(0:N,nmin), lv_item(N,nmin))
       ! perform CM ordering starting from each minimum degree node
       !$omp parallel default(none),private(i), &
  -      !$omp&  shared(nmin,N,indexL,itemL,indexU,itemU,mins,nlevel,lv_index,lv_item)
  +      !$omp&  shared(nmin,N,indexL,itemL,indexU,itemU,degs,mins,nlevel,lv_index,lv_item)
       !$omp do
       do i=1,nmin
  -      call ordering_CM_inner(N, indexL, itemL, indexU, itemU, mins(i), &
  +      call ordering_CM_inner(N, indexL, itemL, indexU, itemU, degs, mins(i), &
           nlevel(i), lv_index(:,i), lv_item(:,i))
  +      if (DEBUG > 0) write(*,*) 'DEBUG:: hecmw_matrix_ordering_CM: i, nstart, nlevel = ', i, mins(i), nlevel(i)
       end do
       !$omp end do
       !$omp end parallel
  +    deallocate(degs)
       ! choose CM ordering with maximum nlevel
       nlevel_max = nlevel(1)
       max_id = 1
  
positive.code:             cnt = cnt + 1
              cntall = cntall + 1
              lv_item(cntall) = knode
              if (cntall == N) exit PRLV
            end if
          end do
        end do PRLV
        if (cnt == 0) then
          !write(*,*) 'DEBUG: choose any uncolored node..'
          do knode = 1, N
            if (iwk(knode) == 0) then
              iwk(knode) = level
  
negative.code:   public :: hecmw_matrix_ordering_CM
    public :: hecmw_matrix_ordering_RCM
  
    integer(kind=kint), parameter :: DEBUG = 0
  
  contains
  
    subroutine hecmw_matrix_ordering_CM(N, indexL, itemL, indexU, itemU, &
  