Graphics, Figures & TablesGraph Binomial Tree

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
deadCat
Posts: 1
Joined: Tue Nov 25, 2014 2:50 pm

Graph Binomial Tree

Post by deadCat »

Hey Guys,

I'm trying to create a binomial tree. It should look like Image
so that the rightmost edge is vertical.

The code, which I have is

Code: Select all

\begin{tikzpicture}[every tree node/.style={draw,circle},
   level distance=1.25cm,sibling distance=.5cm, 
   edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}]
\Tree [.\node[red] { }; 
    [.{ }  
      [.{ }
        [.{ }  [.{ } ]
        ] [.{ } ] 
      ]
      [.{ }  [.{ } ]
      ] 
      [.{ } ]
    ]
    [.{ }
      [.{ }  [.{ } ]
      ] [.{ } ] 
    ] 
    [.{ }  
      [.{ }  ]
    ]
    [.{ }  ] 
    ]
\end{tikzpicture}
but the result is as you see in the attachment. Is there a way to get a vertical edge?
THX
Attachments
bintree.png
bintree.png (11.86 KiB) Viewed 4427 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Graph Binomial Tree

Post by Stefan Kottwitz »

Welcome to the forum!

I guess your question remained unanswered because the example code is not running with TikZ. I tried it, and I got the error message

Code: Select all

! Undefined control sequence.
l.11 \Tree
           [.\node[red] { };
I assume you are using a specific library or another package, such as tikz-qtree. Loading the latter makes the code compilable, if I add a document frame as well. Perhaps post a Infominimal working example next time, so readers could test and improve.

Stefan
LaTeX.org admin
Post Reply