I have written latex code for automata using tikz. I am using \path and \draw for my edges (cf figure1), and I want to have edges of the form (cf figure 2). Any thoughts on how to do it?Figure 1

Figure 2

Thanks in advance

EDIT: Here is my code:

% Packages
\usetikzlibrary {plotmarks,calc,arrows,shapes,snakes,automata,backgrounds,petri,positioning,fit}

\begin{tikzpicture}[->,node distance=1.3cm,>=stealth',bend angle=40,auto,
  place/.style={circle,thick,draw=blue!75,fill=blue!20,minimum size=10mm},
  red place/.style={place,draw=red!75,fill=red!20}
  every label/.style={red},
  every node/.style={scale=.6},
  dots/.style={fill=black,circle,inner sep=2pt},
  initial text={}]

  \node [accepting, place,label={[shift={(0.4,-1.9)}]$x\le850$}] (l1-1)  {$l_1^1$};
  \node [place,right=2cm of l1-1] (l1-2) {$l_2^1$};

  \path (l1-1) edge [in=160,out=190,loop,align=center] node[left]{vp\\$x:=0$} (l1-1)
           edge [in=240,out=210,loop,align=center] node[below,xshift=-7mm]{vs\\
           $x < 850$\\$x:=0$} (l1-1)
           edge [in=140, out=110,loop,align=center] node[above]{ap\\$x \ge 850$
           \\$x:=0$} (l1-1)
    (l1-1) edge node[above]{ats} (l1-2)
    (l1-2) edge [bend right] node[above,align=center]{vp, $x:=0$} (l1-1)
    edge [bend left] node[below,align=center]{vs, $x:=0$} (l1-1);

  \node [accepting, place,right=2cm of l1-2,yshift=1.5cm] (l2-1)  {$l_1^2$};
  \node [place,right=2cm of l2-1,label={[shift={(1.4,-0.9)}]$y\le150$}] (l2-2) {$l_2^2$};
  \node [place,below=2cm of l2-2,label={[shift={(1.4,-0.9)}]$k\le400$}] (l2-3) {$l_3^2$};

  \draw (l2-1) to[in=100,out=90] node[above,align=center] {ats, $y:=0$} (l2-2) ;
  \draw (l2-1) to[in=150,out=40] node[above,align=center] {ap, $y:=0$} (l2-2) ;
  \draw (l2-2) to[in=-20,out=-150] node[below,align=center] {ats, $k:=0$} (l2-1) ;
  \draw (l2-2) to[in=-60,out=-110] node[below,align=center] 
    {ap, $k:=0$\\$y\ge150 \text{ \& } k\ge400$} (l2-1) ;
  \draw [->](l2-2)-- node[right,align=center] {internalp\\ $y\ge150 \text{ \& } k\le400$} (l2-3) ;
  \draw (l2-3) to[in=-90,out=-180] node[above,align=center,xshift=9mm,yshift=-3mm] {vs, $k:=0$}
        (l2-1) ;
  \draw (l2-3) to[in=-110,out=-150] node[below,align=center,xshift=-13mm,yshift=5mm] 
       {vp, $k:=0$\\$k>400$} (l2-1) ;

  \node [accepting, place,below=4cm of l1-1, xshift=-15mm] (l3-1)  {$l_1^3$};
  \node [place,right=1.5cm of l3-1,label={[shift={(0,-1.9)}]$y\le50$}] (l3-2) {$l_2^3$};
  \node [place,right=1.5cm of l3-2,label={[shift={(1.4,-0.9)}]$k\le100$}] (l3-3) {$l_3^3$};
  \node [place,below=1.5cm of l3-3] (l3-4) {$l_4^3$};
  \node [place,below=1.5cm of l3-1] (l3-5) {$l_5^3$};

  \path (l3-1) edge node[below]{vp, $z:=0$} (l3-2)
           edge [bend left] node[above,align=center]{vp, $z:=0$} (l3-2)
           edge node[right]{aget} (l3-5)
    (l3-5) edge [bend left] node[left]{ats} (l3-1)
    (l3-2) edge node[above]{internalp, $z\ge50$} (l3-3)
    (l3-3) edge node[right]{aget} (l3-4)
    (l3-4) edge[bend left] node[left,align=center]{internalp\\ $z\le100$} (l3-3);
  \draw (l3-3) to[in=90,out=90] node[above,align=center] 
       {internalp\\ $z\ge100$} (l3-1) ;

  \node [accepting, place,right=2cm of l3-3] (l4-1)  {$l_1^4$};
  \node [place,right=1.5cm of l4-1,label={[shift={(1.4,-0.9)}]$y\le150$}] (l4-2) {$l_2^4$};
  \node [place,below=1.5cm of l4-1] (l4-3) {$l_3^4$};

  \path (l4-1) edge node[left]{vget} (l4-3)
           edge node[below,align=center]{vp, $t:=0$} (l4-2)
    (l4-2) edge[bend right] node[above]{internalp, $t\ge150$} (l4-1)
    (l4-3) edge node[below,xshift=5mm]{vs, $t:=0$} (l4-2);
\caption{enter1 and enter2 form a false-conflict based on timing constraint}\label{fig:fish}
  • Prepare a single and simple example, show us the code of it, and we will help you fixing it. – LaRiFaRi Aug 10 '15 at 8:38
  • Well I don't really need a fix I just need the idea but here is the code!! – Mr. D Aug 10 '15 at 8:53

Here is an example using rounded corners option with straight lines. I define some styles (sh2n, sh2se, etc.) to shift node's centers.

enter image description here

\begin{tikzpicture}[node distance=2cm and 2cm]
    rc/.style={rounded corners=2mm,line width=1pt},
    place/.style={draw,circle,fill=cyan!10,inner sep=.5mm,minimum size=5mm},
  \node[place] (a) {a};
  \node[place,left=of a] (b) {b};
  \node[place,above right=of a] (c) {c};

  \draw[-stealth,rc] (a) -- node[above]{a to b} (b);
  \draw[-stealth,rc] (a) |- node[green!50!black,above,pos=.75]{a to c} (c);
  \draw[-stealth,rc] (a) -- ([sh2nw]a.center) -- node[above,red] {a to c (bis)} ([sh2n]b.center) -- (b);
  \draw[-stealth,rc] (b) -- ([sh2se]b.center) -| node[below,blue,pos=.25] {b to c} (c);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.