I am doing an experiment, and would like to generate images of Binary Trees and Exponential Trees using LaTeX.

The difference between these two structures is the number of children allowed per node at each level. Binary Trees have a maximum of two, whereas Exponential Trees have 2dimension (with root being dimension = 1).

How would I be able to generate these trees using loops, so I could use a slightly modified Binary Tree TeX to generate the Exponential Tree?

  • You have a few options such as the tree library of TikZ, or Tikz-qtree but the question is not clear. Without your code it's not likely to get an answer to your question as it is.
    – percusse
    Apr 22 '12 at 10:23
  • A binary tree with 32 nodes will be 6 dimensions long (1 node away from 5 dimensions). An exponential tree with 32 nodes will be 4 dimensions long. Here is a list showing differences: d1:{1,1}, d2:{2,2}, d3:{4,8}, d4:{8,64}
    – A T
    Apr 22 '12 at 10:30
  • 1
    So you want to just give the dimension number and get the tree automatically? An example would really clarify your goal with a Minimum Working Example.
    – percusse
    Apr 22 '12 at 12:17
  • 2
    There was a question about automatically generating binary trees a while back: tex.stackexchange.com/q/6258/86 Do any of the answers there look useful? Apr 22 '12 at 16:39