# Drawing transitive diagram in Tikz

I am very new to Tikz. How to draw rounded arrows and nodes without rectangular boundary. I want to draw something like this:

It's quite possible to draw curved paths. There are several ways to do this:

You can use the to directive:

\documentclass{article}
\pagestyle{empty}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\node (A) at (0,0)    {A};
\node (B) at (0,-2in) {B};

\draw[arrows=->] (A) to[out=-45,in=45] (B);
\end{tikzpicture}

\end{document}


You can use controls

\begin{tikzpicture}
\node (A) at (0,0)    {A};
\node (B) at (0,-2in) {B};

\draw[arrows=->] (A) .. controls (2,-0.5in) and (2,-1.5in) .. (B);
\end{tikzpicture}


Here's something that starts to look like the image you posted:

\documentclass{article}
\pagestyle{empty}
\usepackage{tikz}
\usetikzlibrary{calc}
\def\myVpos{0}

\def\myToneList{1/call/m1,
2/lock/l,
3/write/x,
4/unlock/l,
5/ret/m1,
11/call/m3,
12/lock/l,
14/unlock/l,
15/ert/m3}
\def\myTtwoList{6/call/m2,
7/lock/l,
8/write/x,
9/ret/l,
10/ret/m2}
\begin{document}

\begin{tikzpicture}
%% T1 list
\foreach \x/\y/\z
remember=\myVpos as \myVpos (initially 0)
]
in \myToneList
{
\node (t1_\x) at (0,-\myVpos)           {{\ttfamily\y(t1,\z)}};
\node         at ($(t1_\x)+(-1.5cm,0)$) {\x};
}

\xdef\myCurrentPos{t1_1}
\foreach \x/\y/\z in \myToneList
{
\edef\myTest{t1_\x}
\ifx\myCurrentPos\myTest\else\draw[arrows=->] (\myCurrentPos.south) to (t1_\x.north) ; \fi
\xdef\myCurrentPos{t1_\x}
}

%%\draw[arrows=->,dashed] (t1_4.east) to[out=-10,in=10] node[right] {?} (t1_12.east);
\draw[arrows=->,dashed]
(t1_4.east)
..
controls ($(t1_4)+(-10:3.5cm)$)
and
($(t1_12)+(10:5.5cm)$)
..
node[right,pos=0.65] {?}
(t1_12.east);

%% T2 list
\foreach \x/\y/\z
remember=\myVpos as \myVpos (initially 0)
]
in \myTtwoList
{
\node (t2_\x) at (6,-\myVpos)          {{\ttfamily\y(t2,\z)}};
\node         at ($(t2_\x)+(1.5cm,0)$) {\x};
}

\xdef\myCurrentPos{t2_6}
\foreach \x/\y/\z in \myTtwoList
{
\edef\myTest{t2_\x}
\ifx\myCurrentPos\myTest\else\draw[arrows=->] (\myCurrentPos.south) to (t2_\x.north) ; \fi
\xdef\myCurrentPos{t2_\x}
}

%% across T1 and T2
\draw[arrows=->] (t1_4.north east) -- (t2_7.south west);
\draw[arrows=->] (t2_9.south west) -- (t1_12.north east);

\end{tikzpicture}

\end{document}


• Thanks :) But it is giving me "its giving me \z does not match its definition in (t1_12.east) error " error. What should I do? – Jay Sep 29 '13 at 10:34
• @Jay I'm not sure what to tell. Perhaps you've got a misplaced bracket? I'm not able to duplicate your error message. There is no \z in the line where I call (t1_12.east). – A.Ellett Sep 29 '13 at 14:29