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

siblings nodes' height are not the same? #2

Open
01joy opened this issue Feb 18, 2017 · 1 comment
Open

siblings nodes' height are not the same? #2

01joy opened this issue Feb 18, 2017 · 1 comment

Comments

@01joy
Copy link

01joy commented Feb 18, 2017

Hi msbanik,

The library is pretty cool, but I wonder can siblings nodes' height be the same?

For example, code:

from drawtree import draw_level_order
draw_level_order('{3,9,20,1,2,15,17}')

it generates:

      3
     / \
    /   \
   /     \
  9      20
 / \     / \
1   2   /   \
       15   17

Can node 1,2 and node 15,17 be in the same level?

Thank you.

@msbanik
Copy link
Owner

msbanik commented Feb 18, 2017

Hi @01joy ,
Thanks for trying this, I think the algorithm didn't consider the size of the content of each node when drawing. For example draw_level_order('{3,9,20,1,2,5,7}') draws

     3
    / \
   /   \
  /     \
 9      20
/ \     / \
1   2   5   7

If you find a way to solve this, open up a pull request :)

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