I want to reproduce the figure below with TIKZ. The node t_i
depends on its neighboring nodes, so that the further away one is in the temporal axis, the weaker the dependence becomes.
As you can see in the figure below, I have reproduced the structure of the graph but I do not know how to make the equations over the arrows.
\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{fit,positioning,arrows,automata,calc}
\tikzset{
main/.style={circle, minimum size = 10mm, thick, draw =black!80, node
distance = 10mm},
box/.style={rectangle, draw=black!100}
}
\begin{document}
\begin{tikzpicture}
% put nodes
\node[main,draw =red!80] (t1) {$t_i$};
\node[main] (t2) [right= of t1] {$t_{i+1}$};
\node[main] (t3) [right= of t2] {$t_{i+2}$};
\node[main] (tn) [right= of t3] {$t_{n}$};
\node[main] (t) [left= of t1] {$t_{i-1}$};
\node[main] (tt) [left= of t] {$t_{i-2}$};
\node[main] (t0) [left= of tt] {$t_{0}$};
% make path ...
\path (t3) -- node[auto=false]{\ldots} (tn);
\path (tt) -- node[auto=false]{\ldots} (t0);
% draw arrows
\draw [->] (t1) to [out=45,in=135] (tn) node [midway,below]{$P(k=0|\lambda=i)$};
\draw [->] (t1) to [out=35,in=135] (t3);
\draw [->] (t1) to (t2);
\draw [->] (t1) to (t);
\draw [->] (t1) to [out=135,in=35] (tt);
\draw [->] (t1) to [out=135,in=35] (t0);
\end{tikzpicture}
\end{document}
So, if you have suggestions to make this graphic even more beautiful (structure), please do not hesitate.
Thanks
EDIT 1 I modified the code as @Ignasi suggested and I get this:
Is there a simple way to prevent equations from crossing arrows as shown in the figure for arrow t_i to t_ {i + 1}?
\draw [->] (t1) to [out=45,in=135] node [rotate=-5,above]{\tiny
$P(k=n\mid\lambda=1)$} (tn);
\draw [->] (t1) to [out=35,in=135] node [rotate=-5,above]{\tiny
$P(k=i+1\mid\lambda=1)$}(t3) ;
EDIT 2
As suggested by @Ignasi, i get the following picture. However, how could I add an equation between the t_i
and t_ {i + 1}
( t_i
and t_{i-1}
)?
Below the modified code :
\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{fit,positioning,arrows,automata,calc}
\tikzset{
main/.style={circle, minimum size = 10mm, thick, draw =black!80, node distance = 10mm},
box/.style={rectangle, draw=black!100}
}
\begin{document}
\begin{tikzpicture}
% put nodes
\node[main,draw =red!80] (t1) {$t_i$};
\node[main] (t2) [right= of t1] {$t_{i+1}$};
\node[main] (t3) [right= of t2] {$t_{i+2}$};
\node[main] (tn) [right= of t3] {$t_{n}$};
\node[main] (t) [left= of t1] {$t_{i-1}$};
\node[main] (tt) [left= of t] {$t_{i-2}$};
\node[main] (t0) [left= of tt] {$t_{0}$};
% make path ...
\path (t3) -- node[auto=false]{\ldots} (tn);
\path (tt) -- node[auto=false]{\ldots} (t0);
% draw arrows
\draw [->] (t1) to [out=45,in=135] node [midway, above] {$P(k=n|\lambda=i)$} (tn);
\draw [->] (t1) to [out=-45,in=-135] node [midway, below] {$P(k=i+2|\lambda=i)$}(t3);
\draw [->] (t1) to node[midway, below] {$P(k=i+1|\lambda=i)$} (t2);
\draw [->] (t1) to node[midway, above] {$P(k=i-1|\lambda=i)$}(t);
\draw [->] (t1) to [out=-135,in=-45] node [midway, below]{$P(k=i-2|\lambda=i)$}(tt);
\draw [->] (t1) to [out=135,in=35] node [midway, above]{$P(k=0|\lambda=i)$}(t0);
\end{tikzpicture}
\end{document}
\draw [->] (t1) to [out=45,in=135] node [midway,below]{$P(k=0|\lambda=i)$} (tn);
– Ignasi Jan 30 '18 at 11:44