0

This is just a simplified image of a control flow graph which I want to draw. The boxes contain multiple lines of text/mathematical symbols. And the transitions are all labelled using [] brackets. Could someone tell me how to draw the following?Image to be drawn

3

Something like this (with pstricks)?

\documentclass{article}
\usepackage{array} 
\usepackage{mathtools, amsfonts, amssymb}

\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}

\begin{document}

\begin{center}
  \sffamily\everymath{\scriptstyle}
  \begin{pspicture}
    \psset{arrows=->, arrowinset=0.15, linewidth=0.6pt, nodesep=2pt, labelsep=2pt, colsep=1cm, rowsep=1.5cm, linejoin=1}
    \begin{psmatrix}
      & \ovalnode{S}{\,start\strut\,}\\
      & \ovalnode{A}{\enspace\,A\strut\enspace\,} \\
      \ovalnode{B}{\enspace\,B\strut\enspace\,} & \\
      & \ovalnode{C}{\enspace\,C\strut\enspace\,}\\
    \end{psmatrix}
    \ncline{S}{A}\nbput{\renewcommand\arraystretch{0.8}\begin{tabular}{|>{\footnotesize}l|}\hline Some\\ condition\\\hline\end{tabular}}
    \ncline[]{A}{B}\nbput{\footnotesize[true]}%
    \ncline[]{A}{C}\naput{\footnotesize[false]}%
    \ncline{B}{C}\nbput{\renewcommand\arraystretch{0.8}\begin{tabular}{|>{\footnotesize}l|}\hline Some other\\ condition\\\hline\end{tabular}}
    \ncdiagg[angleA=50, armA=2.4]{C}{A}\nbput{\footnotesize[expression]}%
  \end{pspicture}
\end{center}

\end{document} 

enter image description here

3

With tikz

\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning}
\tikzset{myellipse/.style={ellipse,draw,minimum width=1.3cm,minimum height=5mm},
myrectangle/.style={draw,text width=1.2cm,align=center,midway,font=\scriptsize},
branode/.style={midway,font=\scriptsize}}
\begin{document}
\begin{tikzpicture}[>=stealth]
\node[myellipse](1){start};
\node[myellipse,below=of 1](2){A};
\node[myellipse,below left=of 2](3){B};
\node[myellipse,below right=of 3](4){C};
\draw[->](1)--(2)node[myrectangle,left=1mm]{some condition};
\draw[->](2)--(3)node[branode,left,anchor=south east]{[true]};
\draw[->](3)--(4)node[myrectangle,left=1mm,anchor=north east]{some other condition};
\draw[->](2)--(4)node[branode,right]{[false]};
\draw[->](4)--+(2,2)coordinate(5)node [branode,right,anchor=north west]{[expression]};
\draw[->](5)--(1);
\end{tikzpicture}

\end{document}

enter image description here

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.