code: @Override
      final int nextN(int n) {
          if (size == 0) return 0;
          for (int i = n + 1; i < g1.length; i++)
              if (m1[i] == UNMAPPED && t1[i] > 0) return i;
          for (int i = n + 1; i < g1.length; i++)
              if (m1[i] == UNMAPPED) return i;
          return nMax();
      }
docs: Given the current query candidate (n), find the next candidate. The next
  candidate is the next vertex > n (in some ordering) that is unmapped and
  is adjacent to a mapped vertex (terminal). If there is no such vertex
  (disconnected) the next unmapped vertex is returned. If there are no more
  candidates m == |V| of G1.
  
  @param n previous candidate n
  @return the next value of n