Majority voting in find_nearest()

Paul Harris paulharris at computer.org
Thu Oct 16 11:38:39 UTC 2008


Hi Will, Sylvain,

I am not so sure that we can generate an iterator just like that, because
two nodes that are close to a point may be on two sides of the tree - if the
target is right on a dividing line (hope thats not too vague to get the
picture).

I think I emailed the list a while back in response to a query about getting
the last 4 closest points via find_nearest_if or visit_nearest.  I think the
only way may be to approach it from that direction...

the basic idea is that the visitor is called as the algorithm steps through
the tree.  It adjusts the bounds as it goes via the return value (true or
false - in response to the question "did the visitor just visit a point that
is closer to the target").

If the visitor always returns false, it'll end up visiting every node in the
tree.
If it returns true only for the points that are closer to the target, then
it'll end up visiting ALL of the points that are distance away == nearest
distance.  and it'll also visit the nodes leading up to the discovery of the
closest points.

that all may not be perfectly accurate, but do you get the idea?  thats how
I would approach the problem

Paul

2008/10/16 Sylvain Bougerel <sylvain.bougerel.devel at gmail.com>

> Hi Willi,
>
> I bumped into the same requirement in the past. My personal desire it
> to implement an iterator on the nearest neighbor that goes outward.
> With this, you could call i++ until you find the point that correspond
> to your requirements. I've just started working on this recently, and
> you might have to wait a bit for a similar feature to come in.
>
>
> At the moment, regrettably, I cannot think of any solution that does
> not involve modifying the library itself.
>
> On Wed, Oct 15, 2008 at 7:06 PM, Willi Richert <w.richert at gmx.net> wrote:
> > Hi,
> >
> > in some situations the same point is inserted with different labels. In
> this
> > case find_nearest returns an arbitrary point of these euqally nearest
> points
> > to the query point.
> >
> > However, it would be nice if one could get either all the points that are
> > nearest and identical or to have a method that returns the label of the
> > majority of the (identical) nearest points.
> >
> > Would that be feasible with the current libkdtree++ implementation?
> >
> > Regards,
> >
> > wr
> >
> > _______________________________________________
> > libkdtree-devel mailing list
> > libkdtree-devel at lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel
> >
> >
>
> _______________________________________________
> libkdtree-devel mailing list
> libkdtree-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20081016/8c2466de/attachment.htm 


More information about the libkdtree-devel mailing list