docs: private int processNewNeighbors(WritableDataStore<HashSetModifiableDBIDs> flag, HashSetModifiableDBIDs newFwd, HashSetModifiableDBIDs oldFwd, HashSetModifiableDBIDs newRev, HashSetModifiableDBIDs oldRev) {
      int counter = 0;
      // nn_new
      if(!newFwd.isEmpty()) {
        for(DBIDIter sniter = newFwd.iter(); sniter.valid(); sniter.advance()) {
          // nn_new X nn_new
          for(DBIDIter niter2 = newFwd.iter(); niter2.valid(); niter2.advance()) {
            if(DBIDUtil.compare(sniter, niter2) < 0) { // Only x < y.
              addpair(flag, sniter, niter2);
              counter++;
            }
          }
          // nn_new X nn_old
          for(DBIDMIter niter2 = oldFwd.iter(); niter2.valid(); niter2.advance()) {
            if(DBIDUtil.equal(sniter, niter2)) {
              continue;
            }
            addpair(flag, sniter, niter2);
            counter++;
          }
        }
      }
      // rnn_new
      if(!newRev.isEmpty()) {
        for(DBIDIter nriter = newRev.iter(); nriter.valid(); nriter.advance()) {
          // rnn_new X rnn_new
          for(DBIDIter niter2 = newRev.iter(); niter2.valid(); niter2.advance()) {
            if(DBIDUtil.compare(nriter, niter2) < 0) { // Only x < y
              addpair(flag, nriter, niter2);
              counter++;
            }
          }
          // rnn_new X rnn_old
          for(DBIDIter niter2 = oldRev.iter(); niter2.valid(); niter2.advance()) {
            if(DBIDUtil.equal(nriter, niter2)) {
              continue;
            }
            addpair(flag, nriter, niter2);
            counter++;
          }
        }
      }
  
      // nn_new
      if(!newFwd.isEmpty()) {
        for(DBIDIter sniter2 = newFwd.iter(); sniter2.valid(); sniter2.advance()) {
          // nn_new X rnn_old
          for(DBIDIter niter2 = oldRev.iter(); niter2.valid(); niter2.advance()) {
            if(!DBIDUtil.equal(sniter2, niter2)) {
              addpair(flag, sniter2, niter2);
              counter++;
            }
          }
          // nn_new X rnn_new
          for(DBIDIter niter2 = newRev.iter(); niter2.valid(); niter2.advance()) {
            if(DBIDUtil.compare(sniter2, niter2) < 0) {
              addpair(flag, sniter2, niter2);
              counter++;
            }
          }
        }
      }
      // nn_old
      if(!newRev.isEmpty() && !oldFwd.isEmpty()) {
        for(DBIDIter niter = oldFwd.iter(); niter.valid(); niter.advance()) {
          // nn_old X rnn_new
          for(DBIDIter niter2 = newRev.iter(); niter2.valid(); niter2.advance()) {
            if(DBIDUtil.equal(niter, niter2)) {
              continue;
            }
            addpair(flag, niter, niter2);
            counter++;
          }
        }
      }
      return counter;
    }