I would like to produce the following diagram.
Thanks to the following comments and one example from TeXample.net, I have done the following code. There is some problems. How can I fix them ?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\tikzstyle{frame} = [
rectangle, draw,
text width=2em, text centered,
minimum height=4em
]
\tikzstyle{line} = [draw, -latex']
\begin{document}
\begin{tikzpicture}[node distance = 3cm]
\node [frame] (pop) {Population};
\node [above of=pop, left of=pop] (init) {Initialisation};
\node [below of=pop, left of=pop] (term) {Termination};
\node [frame, above of=pop, right of=pop] (parents) {Parents};
\node [frame, below of=pop, right of=pop] (off) {Offspring};
\path [line] (parents) -- node[right,pos=.4] {Recombination} node[right,pos=.6] {Mutation} (off);
\path [line] (init) |- (pop);
\path [line] (pop) -| (term);
\path [line] (off) -| node[below,pos=.25] {Survivor selection}(pop);
\path [line] (pop) |- node[above,pos=.75] {Parents selection} (parents);
\end{tikzpicture}
\end{document}
Here is my huggly output !
\draw[nodes=right] (Parents) edge node[pos=.33] {Recombination} node[pos=.67] {Mutation} (Offspring);
Or\draw (Population) |- node[above,pos=.75] {Parent selection} (Parents);
And thearrows
library provides a few arrow styles (e.g.-triangle 45
). Nodes not attached to the liens can be placed either manually or with the help of thepositioning
library. – Qrrbrbirlbel Jan 23 '13 at 20:24