1 \usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri} 2 \begin{tikzpicture}[ 3 every place/.style={circle,draw=blue!50,fill=blue!20,thick,inner sep = 2pt,minimum size = 6mm}, 4 every transition/.style={rectangle,draw=black!50,fill=black!20,thick,inner sep = 2pt,minimum size = 6mm}, 5 red place/.style = {place,draw=red!75,fill=red!20}, 6 every label/.style = {red,font=\small}, 7 node distance=1.3cm,bend angle=45,on grid,>=latex,auto 8 ] 9 10 \node (a) [place,tokens =1] {}; 11 \node (b) [place ,below=of a] {b}; 12 \node (c) [place ,below=of b] {c}; 13 \node (d) [place ,below=of c] {d}; 14 \node (e) [place ,tokens=1,below=of d] {}; 15 16 \node (f) [transition,left = of b] {f} 17 edge [post] (b) 18 edge [post,bend right] (c) 19 edge [pre,bend left] (a) 20 ; 21 22 \node (g) [transition,right= of b] {g} 23 edge [pre] (b) 24 edge [pre,bend left] (c) 25 edge [post,bend right] (a) 26 ; 27 28 \node (h) [transition,left = of d] {h} 29 edge [post] (d) 30 edge [post,bend right] (e) 31 edge [pre,bend left] (c) 32 ; 33 34 \node (i) [transition,right= of d] {i} 35 edge [pre] (d) 36 edge [pre,bend left] (e) 37 edge [post,bend right] (c) 38 ; 39 40 41 \begin{scope}[on background layer] 42 \node (r1) [fill=black!10,rounded corners,fit=(a)(b)(c)(d)(e)(f)(g)(h)] {}; 43 \end{scope} 44 45 \begin{scope}[xshift=6cm] 46 \node (a) [place,tokens =1] {}; 47 \node (b) [place ,below=of a] {b}; 48 \node (c) [red place ,below=of b,xshift=-5mm,tokens=3] {}; 49 \node (d) [red place ,below=of b,xshift=5mm] {d}; 50 \node (e) [place ,below=of d,xshift=-5mm] {e}; 51 \node (f) [place ,below=of e] {f}; 52 53 \node (g) [transition,left= of b] {g} 54 edge [post] (b) 55 edge [post] (c) 56 edge [pre] (d) 57 edge [pre,bend left] (a) 58 ; 59 60 \node (h) [transition,right= of b] {h} 61 edge [post] (b) 62 edge [post] (c) 63 edge [pre] (d) 64 edge [pre,bend right] (a) 65 ; 66 67 68 \node (i) [transition,left= of e] {i} 69 edge [post] (e) 70 edge [post] (c) 71 edge [pre] (d) 72 edge [pre,bend right] (f) 73 ; 74 \node (j) [transition,right= of e] {j} 75 edge [post] (e) 76 edge [post] (c) 77 edge [pre] (d) 78 edge [pre,bend left] (f) 79 ; 80 81 82 83 84 \end{scope} 85 86 \begin{scope}[on background layer] 87 \node (r2) [fill=black!10,rounded corners,fit=(a)(b)(c)(d)(e)(f)(g)(h)] {}; 88 \end{scope} 89 90 \draw [-to ,decorate,decoration={snake,amplitude=.4mm,segment length=1mm,post length=1mm}](r1)--(r2) node [above,text width=1cm,midway] {how are you $a+b$}; 91 \end{tikzpicture}