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 4497 times

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
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