Skip to content

pre_order for subtrees fails #30

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

Open
GoogleCodeExporter opened this issue Mar 19, 2015 · 1 comment
Open

pre_order for subtrees fails #30

GoogleCodeExporter opened this issue Mar 19, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

When trying to list all leafs in a given subtree of the merge tree created by 
to_tree, it fails in some cases with 'Index out of bounds'

What steps will reproduce the problem?
Run the following code to get the exception:

from hcluster import *
dist = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4]
x = linkage(dist)
t = to_tree(x)
t.right.right.pre_order()

What version of the product are you using? On what operating system?

I'm using the port py26-hcluster version 0.2.0 on OS X 10.6 with Python 2.6.

Please provide any additional information below.

Looking at hierarchy.py (revision 132), it looks like the problem is that the 
lists lvisited and rvisited (line 752 and 753) are indexed using node IDs, 
while their size is 2*n (n is the size of the subtree in that node). If the 
tree is large enough, the node ID of the (for example) rightmost leaf is 
actually larger than 2*n for most subtrees containing it.

Original issue reported on code.google.com by ondra...@gmail.com on 20 Jul 2010 at 9:30

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

No branches or pull requests

1 participant