10

Possible Duplicate:
Typesetting a directed, weighted graph with TikZ

I would like to draw a DAG - Directed acyclic graph. How can I do this?

1 Answers1

16

A solution with tkz-graph based on TikZ. You can used the styles from TikZ but you need to learn another syntax (very minimal) and you can use TikZ.

An advantage is that you can use scale without difficulty.

    \documentclass{scrartcl}
    \usepackage{tkz-graph}  
    \usetikzlibrary{shapes.geometric}%   
    \thispagestyle{empty}
    \begin{document}

    \tikzstyle{VertexStyle} = [shape            = ellipse,
                               minimum width    = 6ex,%
                               draw]

    \tikzstyle{EdgeStyle}   = [->,>=stealth']      

    \begin{tikzpicture}[scale=1.5] 
    \SetGraphUnit{2} 
    \Vertex{11}  \NO(11){5}   \WE(11){2} \SO(11){7} \EA(11){10}
                 \SOEA(11){9} \SOEA(10){3}\SOEA(9){8}
    \Edges(5,11,10) \Edges(3,8,9) \Edges(7,11,2)
    \Edges(11,9)    \Edges(3,10)
    \end{tikzpicture}
    \end{document} 

The first example of your link gives

enter image description here

egreg
  • 1,121,712
Alain Matthes
  • 95,075
  • 4
    that is what some people like: that others do all the work ... –  Dec 17 '11 at 14:17
  • 9
    @Herbert I read your comment as criticism of both Altermundus and Filipe... but I would like to stress that without the answer of Altermundus, I would not have known about tkz-graph and its potential for simplifications (and I am probably not the only one). Considering that Altermundus himself is the author of tkz-graph (unless I am mistaken), I would judge that his answer is a win-win-situation for him and Filipe. – Christian Feuersänger Dec 17 '11 at 20:41
  • Thanks for the help! But I'm with trouble to print in pdf, I just can print it into DVI? – Filipe Ferminiano Dec 17 '11 at 21:28
  • @FilipeFerminiano Use comments, not answers, please. – Harold Cavendish Dec 17 '11 at 21:45