I have the following code, which generates the image shown below.
\tikzstyle{decision} = [diamond, draw, text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{bigblock} = [rectangle, draw, text width=10em, text centered, rounded corners, minimum height=4em]
\tikzstyle{invisible} = [rectangle, node distance=3cm, text=white]
\tikzstyle{line} = [draw, -latex']
\begin{tikzpicture}[node distance = 2.5cm, auto, scale=1.0, every node/.style={transform shape}]
% Place nodes
\node [block] (c0) {c0};
\node [block, right of=c0, node distance=3cm] (c1) {c1};
\node [bigblock, below of=c0] (point) {ver};
\node [decision, below of=point] (check) {?};
\node [bigblock, below of=check] (resume) {resume};
\node [bigblock, right of=check, node distance=4cm] (rollback) {rollback};
\node [invisible, below left of=resume] (c02) {};
\node [invisible, below right of=resume] (c12) {};
% Draw edges
\path [line] (c0) -- (point);
\path [line] (c1) -- (point);
\path [line] (point) -- (check);
\path [line] (check) -- node [near start] {yes} (resume);
\path [line] (check) -- node [near start] {no} (rollback);
\path [line] (resume) -- (c02);
\path [line] (resume) -- (c12);
\end{tikzpicture}
I'm trying to center the node (point)
below (c0)
and (c1)
, so that the arrows to the node are also straight. I also wanted the last two arrows, coming from node (resume)
to be straight. I was also trying to create an arrow coming from node (rollback)
to the arrow between (c1)
and (point)
but I don't know how to do it. If somebody could help I'd be truly grateful!
Best Answer
These things are all straightforward if you make use of the
|-
and-|
syntax, which has been explained very well in this answer by Torbjørn T..