docs: private void innerScan(HilbertFeatures hf, final int i, final int maxcount) {
      final O p = hf.relation.get(hf.pf[i].id); // Get only once for performance
      int a = i, b = i;
      int level = h, levela = h, levelb = h;
      // Explore up to "maxcount" neighbors in this pass
      for(int count = 0; count < maxcount; count++) {
        final int c; // Neighbor to explore
        if(a == 0) { // At left end, explore right
          // assert (b < capital_n - 1);
          levelb = Math.min(levelb, hf.pf[b].level);
          b++;
          c = b;
        }
        else if(b >= capital_n - 1) { // At right end, explore left
          // assert (a > 0);
          a--;
          levela = Math.min(levela, hf.pf[a].level);
          c = a;
        }
        else if(hf.pf[a - 1].level >= hf.pf[b].level) { // Prefer higher level
          a--;
          levela = Math.min(levela, hf.pf[a].level);
          c = a;
        }
        else {
          // assert (b < capital_n - 1);
          levelb = Math.min(levelb, hf.pf[b].level);
          b++;
          c = b;
        }
        if(!hf.pf[i].nn_keys.contains(hf.pf[c].id)) {
          // hf.distcomp ++;
          hf.pf[i].insert(hf.pf[c].id, distq.distance(p, hf.pf[c].id), k);
          if(hf.pf[i].nn.size() == k) {
            if(hf.pf[i].sum_nn < omega_star) {
              break; // stop = true
            }
            final int mlevel = Math.max(levela, levelb);
            if(mlevel < level) {
              level = mlevel;
              final double delta = hf.minDistLevel(hf.pf[i].id, level);
              if(delta >= hf.pf[i].nn.peek().doubleValue()) {
                break; // stop = true
              }
            }
          }
        }
      }
      double br = hf.boxRadius(i, a - 1, b + 1);
      double newlb = 0.0;
      double newub = 0.0;
      for(ObjectHeap.UnsortedIter<DoubleDBIDPair> iter = hf.pf[i].nn.unsortedIter(); iter.valid(); iter.advance()) {
        DoubleDBIDPair entry = iter.get();
        newub += entry.doubleValue();
        if(entry.doubleValue() <= br) {
          newlb += entry.doubleValue();
        }
      }
      if(newlb > hf.pf[i].lbound) {
        hf.pf[i].lbound = newlb;
      }
      if(newub < hf.pf[i].ubound) {
        hf.pf[i].ubound = newub;
      }
    }