drawtree icon indicating copy to clipboard operation
drawtree copied to clipboard

siblings nodes' height are not the same?

Open 01joy opened this issue 8 years ago • 1 comments

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.

01joy avatar Feb 18 '17 09:02 01joy

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 :)

msbanik avatar Feb 18 '17 20:02 msbanik