@Override public DoubleDBIDList reverseKNNQuery(DBIDRef id,int k){
  if (k > settings.kmax) {
    throw new IllegalArgumentException("Parameter k has to be less or equal than " + "parameter kmax of the MCop-Tree!");
  }
  ModifiableDoubleDBIDList result=DBIDUtil.newDistanceDBIDList();
  ModifiableDBIDs candidates=DBIDUtil.newArray();
  doReverseKNNQuery(k,id,result,candidates);
  Map<DBID,KNNList> knnLists=batchNN(getRoot(),candidates,k);
  result.sort();
  for (DBIDIter iter=candidates.iter(); iter.valid(); iter.advance()) {
    DBID cid=DBIDUtil.deref(iter);
    KNNList cands=knnLists.get(cid);
    for (DoubleDBIDListIter iter2=cands.iter(); iter2.valid(); iter2.advance()) {
      if (DBIDUtil.equal(id,iter2)) {
        result.add(iter2.doubleValue(),cid);
        break;
      }
    }
  }
  result.sort();
  return result;
}

@ Override public DoubleDBIDList reverseKNNQuery ( DBIDRef id , int k ) { if ( k > settings . kmax ) { throw new IllegalArgumentException ( "Parameter k has to be less or equal than " + "parameter kmax of the MCop-Tree!" ) ; } ModifiableDoubleDBIDList result = DBIDUtil . newDistanceDBIDList ( ) ; ModifiableDBIDs candidates = DBIDUtil . newArray ( ) ; doReverseKNNQuery ( k , id , result , candidates ) ; Map < DBID , KNNList > knnLists = batchNN ( getRoot ( ) , candidates , k ) ; result . sort ( ) ; for ( DBIDIter iter = candidates . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { DBID cid = DBIDUtil . deref ( iter ) ; KNNList cands = knnLists . get ( cid ) ; for ( DoubleDBIDListIter iter2 = cands . iter ( ) ; iter2 . valid ( ) ; iter2 . advance ( ) ) { if ( DBIDUtil . equal ( id , iter2 ) ) { result . add ( iter2 . doubleValue ( ) , cid ) ; break ; } } } result . sort ( ) ; return result ; }
performs a reverse k - nearest neighbor query for the given object id . the query result is in ascending order to the distance to the query object .
