protected DBIDs findNeighbors ( DBIDRef q , long [ ] nD , ArrayModifiableDBIDs S , Relation < V > relation ) { // Weights for distance (= rectangle query) DistanceQuery < V > dq = relation . getDistanceQuery ( new SubspaceMaximumDistanceFunction ( nD ) ) ; // TODO: add filtering capabilities into query API! // Until then, using the range query API will be unnecessarily slow. // RangeQuery<V> rq = relation.getRangeQuery(df, DatabaseQuery.HINT_SINGLE); ArrayModifiableDBIDs nC = DBIDUtil . newArray ( ) ; for ( DBIDIter it = S . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { if ( dq . distance ( q , it ) <= w ) { nC . add ( it ) ; } } return nC ; }
Find the neighbors of point q in the given subspace