12

I wanted to plot a flow chart graph which looks similar to this diagram:

flow chart

that comes from this source.

  1. Which package would be best for that?
  2. I don't want to use pstricks
beyeran
  • 359

3 Answers3

13

An example with pgf/tikZ just for your inspiration.

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.geometric}

\begin{document}
  \begin{tikzpicture}[%
    ->,
    shorten >=2pt,
    >=stealth,
    node distance=1cm,
    noname/.style={%
      ellipse,
      minimum width=5em,
      minimum height=3em,
      draw
    }
  ]
    \node[noname] (1)                                             {1};
    \node[noname] (2) [below=of 1]                                {2};
    \node[noname] (4) [node distance=1cm and 3mm,below left=of 2] {4};
    \node[noname] (3) [left=of 4]                                 {3};
    \node[noname] (5) [below=of 4]                                {5};
    \node[noname] (6) [node distance=2cm,right=of 5]              {6};

    \path (1) edge                   node {} (2)
          (2) edge                   node {} (3)
          (2) edge                   node {} (4)
          (2) edge                   node {} (6)
          (3) edge                   node {} (5)
          (4) edge                   node {} (5)
          (5) edge [bend right=20pt] node {} (2);
  \end{tikzpicture}
\end{document}

More examples in the according tikZ Example Gallery.


alt text

11

This doesn't need TeX. You can just use graphviz to draw such graph. Of course, many LaTeX packages like pstricks and tikz can draw these graph, but I think graphviz is still easier to use.

It seems an example copied from main page of graphviz will be useful. With graphviz we don't have to tell computer where the nodes are, only edges are needed.

digraph finite_state_machine {
    rankdir=LR;
    size="8,5"
    node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
    node [shape = circle];
    LR_0 -> LR_2 [ label = "SS(B)" ];
    LR_0 -> LR_1 [ label = "SS(S)" ];
    LR_1 -> LR_3 [ label = "S($end)" ];
    LR_2 -> LR_6 [ label = "SS(b)" ];
    LR_2 -> LR_5 [ label = "SS(a)" ];
    LR_2 -> LR_4 [ label = "S(A)" ];
    LR_5 -> LR_7 [ label = "S(b)" ];
    LR_5 -> LR_5 [ label = "S(a)" ];
    LR_6 -> LR_6 [ label = "S(b)" ];
    LR_6 -> LR_5 [ label = "S(a)" ];
    LR_7 -> LR_8 [ label = "S(b)" ];
    LR_7 -> LR_5 [ label = "S(a)" ];
    LR_8 -> LR_6 [ label = "S(b)" ];
    LR_8 -> LR_5 [ label = "S(a)" ];
}

alt text

Leo Liu
  • 77,365
2

If you want to draw graph (graph theory) diagram, then PSTricks can do this easily.

See this tutorial.

Display Name
  • 46,933
  • I think answers on this site should be self-contained. Please add an example from the tutorial. – Seamus Dec 17 '11 at 14:10