I am trying to construct a function in Tex called \rootedtree, which takes in a a tree written in the notation of J. Butcher and then prints out the corresponding tree in TikZ.
For instance consider the trees here: http://alexander.lundervold.com/talks/ICMAT_oct2014/assets/grafting.jpg , just ignore the operations, we do not need them here. From left to right, the corresponding notation is
[*]
[*,*]
[[*,*],*,*]
etc.
So the idea is that * corresponds to a node and the square brackets binds the nodes/trees inside to the same root. For the computer scientists out there, note that the root are downwards and the leaves are upwards.
So ultimately I want a something like this
\rootedtree([*,*])
which then draws the corresponding tree in TikZ, where the roots are evenly distributed upwards, e.g. if there is a single child, then it points directly up (90 degrees on both sides), if there are two childs then there are 60 degrees between them and 60 degrees to level on both sides.
I have close to none experience programming things in Tex myself and therefore have no idea how to get started. Any help is highly appreciated. Are there any other packages, where there is something like this and I do not have to start from scratch?