Boost logo

Boost Users :

Subject: Re: [Boost-users] Interprenting nearest's neighbor's output
From: Georgios Samaras (georgesamarasdit_at_[hidden])
Date: 2014-04-15 08:05:05

I do not have a big experience with NNs, but it seems a very very
interesting problem to me! However, I thought that this would be the case
(that you do not care about the order, maybe an argument for sorted results
or not, would be nice).

The query iterators worked as expected, but what is the difference? I mean,
why the iterators return sorted results and the other method doesn't? Is
the other method faster than iterators (in datasets with really many points
or really high dimensions)?

On Tue, Apr 15, 2014 at 12:38 PM, Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]
> wrote:

> Georgios Samaras wrote:
>> I changed the code to use points, but order the items are returned is not
>> understandable by me.
>> I request the 5 NNs of the query point (0, 0), in a dataset of points (0,
>> 0), (1, 1), .., (9, 9).
>> The output I receive is this:
>> knn query result:
>> POINT(4 4)
>> POINT(3 3)
>> POINT(2 2)
>> POINT(0 0)
>> POINT(1 1)
>> If you need the code, let me know. I remember that I read that the order
>> is not specified, but does that mean that there is no logic in the results?
>> I mean, clearly the 1st NN is (0, 0).
> If the kNN query using query() function is performed, the order of
> returned Values isn't specified. The function returns 5 NNs, not sorted
> 5NNs. This way we save a call of sort() or sort_heap().
> AFAIK the most typical use case would be to perform a kNN query and then
> to process all of those neighbours so it's not needed to sort them
> prematurely.
> On the other hand in the case of query iterators (
> geometry/spatial_indexes/queries.html#geometry.spatial_
> indexes.queries.breaking_or_pausing_the_query )
> you should get closer Values first.
> Regards,
> Adam
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at