2

I would like to create a graphenter image description here that look as follows. The idea is that the nine nodes falls on the same plan, i.e., at the same time. I am having some problems to create a tree with variable branch lengths. Many thanks.

I am starting with these codes that give the following graph.

\documentclass{report}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{graphics}
\usetikzlibrary{trees}
\newenvironment{conditions}
{\par\vspace{\abovedisplayskip}\noindent\begin{tabular}{>{$}l<{$} @{${}={}$} l}}
    {\end{tabular}\par\vspace{\belowdisplayskip}}
\tikzstyle{level 1}=[level distance=3.5cm, sibling distance=2cm]
\tikzstyle{level 2}=[level distance=3.5cm, sibling distance=2cm]

% Define styles for bags and leafs
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=3pt,fill, inner sep=0pt]




\begin{document}
\begin{figure}[!ht]
    \centering
    \begin{tikzpicture}
    [grow                    = right,
    sibling distance        = 6em,
    level distance          = 10em,
    edge from parent/.style = {draw, -latex},
    every node/.style       = {font=\footnotesize},
    sloped]
    \node[bag] {$r^{*}_{i, j}$}
    child {node[bag] {$r^{*}_{i+1, k_{3}}$}
        edge from parent [ - >] node[below]{$p_{d}$}
    }
    child {node[bag] {$r^{*}_{i+1, k_{2}}$}
        edge from parent [ - >] node[above]{$p_{m}$}
    }
    child {node[bag] {$r^{*}_{i+1, k_{1}}$}
        edge from parent [ - >] node[above]{$p_{u}$}
    };
    \end{tikzpicture}
    \caption{ The Branching Process of a Tree Element}
\end{figure}
\end{document}

enter image description here

2
  • 1
    Please post your code in your question. Also, please expand it to a full minimal working example. It is much easier to help you you if we can start with some compilable code that illustrates your problem. A MWE should start with a \documentclass command, include any necessary packages and be as small as possible to demonstrate your problem.
    – user30471
    Sep 5, 2017 at 17:33
  • welcome to tex.se! why you delete my nice formatting your code? now you have unreadable mess ... :-( . as far as it is seems, this image is more easy to draw as pure tikz image.
    – Zarko
    Sep 5, 2017 at 17:43

1 Answer 1

6
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{positioning, quotes, shapes.geometric}

\begin{document}
    \begin{tikzpicture}[
     node distance = 6mm and 22mm,
        dot/.style = {circle, fill=gray, node contents={}},
every label/.style = {inner sep=1pt, font=\footnotesize}
                        ]
\node (t) [trapezium,
           fill=gray!20, draw, dashed,
           minimum width=44mm, minimum height=11mm,
           rotate=-90] {};%shape border
\draw[dashed]   (t.north) -- (t.south)
                (t.west)  -- (t.east);
%
\node (r01)[dot,below left=of t.south,
            label=above left:{$r*_{i,j}$}];
%
\node (r11)[dot, at={(t.bottom left corner)},
            label=60:{$r^{*}_{i+1, k_{1}}$}];
\node (r12)[dot, at={(t.west)},
            label=60:{$r^{*}_{i+1, k_{2}}$}];
\node (r13)[dot, at={(t.top left corner)},
            label=60:{$r^{*}_{i+1, k_{3}}$}];
%
\node (r21)[dot, at={(t.south)}];
\node (r22)[dot, at={(t.center)}];
\node (r23)[dot, at={(t.north)}];
%
\node (r31)[dot, at={(t.bottom right corner)},
            label=-60:{$r^{*}_{i+1, k_{1}}$}];
\node (r32)[dot, at={(t.east)},
            label=-60:{$r^{*}_{i+1, k_{2}}$}];
\node (r33)[dot, at={(t.top right corner)},
            label=-60:{$r^{*}_{i+1, k_{3}}$}];
%

\draw[->]
    (r01) edge [sloped,"$p_{d}$"] (r11)
    (r01) edge [sloped,"$p_{m}$"] (r12)
    (r01) edge [sloped,"$p_{u}$"] (r13)
%
    (r01) edge [sloped] (r21)
    (r01) edge [sloped] (r22)
    (r01) edge [sloped] (r23)
%
    (r01) edge [sloped] (r31)
    (r01) edge [sloped] (r32)
    (r01) edge [sloped] (r33)
    ;
\node (r02)[dot, left =of r01];
\node (r03)[dot, below=of r01 |- r31];
\draw[->]
    (r02) edge  (r01)
    (r02) edge  (r03);
%
\coordinate[below=of r02 |- r03] (time-1);
\coordinate[below=of r33 |- r03] (time-2);
\draw[gray, very thick, ->]
    (time-1 -| r02.west) -- (time-2) node[below left] {time};
\draw[gray]
    (time-1)       +(0,1mm) -- ++ (0,-1mm) node[below] {$t$}
    (time-1 -| r31)+(0,1mm) -- ++ (0,-2mm) node[below] {$t_x$};
    \end{tikzpicture}

gives

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .