Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I think I'm removing nodes too quickly #14

Open
jxmorris12 opened this issue Jul 12, 2016 · 1 comment
Open

I think I'm removing nodes too quickly #14

jxmorris12 opened this issue Jul 12, 2016 · 1 comment

Comments

@jxmorris12
Copy link

jxmorris12 commented Jul 12, 2016

I've run into a problem where I do something like:

for node in nodesNotInTree {
   var closestNode = tree.nearest(node, 1)[0][0];
   tree.remove(closestNode);
}

This is an attempt to match every node in nodesNotInTree to a unique node in tree. However, for some reason, this method of removal isn't working properly. Instead, closestNode is the closest node from the original tree, instead what it should be: of the closest node in the tree that hasn't yet been accessed.

Hope that explained my problem clearly. Am I doing things in the wrong order?

@jxmorris12 jxmorris12 changed the title I think I'm removing nodes too fast I think I'm removing nodes too quickly Jul 12, 2016
@mirceapricop
Copy link
Contributor

Could you maybe leave a jsfiddle link so I can debug it in there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants