showell/binary-tree-diagram - version: 1.0.1

for more information visit the package's GitHub page

Package contains the following modules:

This package draws binary trees.

Here is a demo. If for some reason the demo is not up, you can always build it from the repo.

This package only draws binary trees. You may want to try elm-tree-diagram for similar code that works with arbitrary trees.

The trees are drawn with SVG in a viewbox, so you can scale them as needed.

Trees are always shown symmetrically, even if the tree is somewhat unbalanced. (I consider this a feature, even for unbalanced trees, but you may differ.)

If you have a deep tree, the leaves will be teeny tiny. A nice way to enhance this package would be to have some kind of zoom capability.

The code here is pretty tiny--only a few hundred lines. Feel free to fork it or subsume it as needed to make it work better for your particular needs.

Thanks!

-- Steve Howell