8.1. Exemplos do graphviz

Nas seções a seguir alguns exemplos de gráficos.

[Dica]

No site http://www.graphviz.org/Gallery.php temos uma galeria de gráficos que podem ser baixados e customizados.

8.1.1. Grafos

["graphviz", "grafo.png", width="30%"]
.Exemplo de grafo.
---------------------------------------------------------------------
graph G {
  n0 -- n1 -- n2 -- n3 -- n0;
}
---------------------------------------------------------------------

Figura 8.1. Exemplo de grafo.

grafo.png

Figura 8.2. Exemplo de grafo (width="50%")

grafo50.png

["graphviz"]
---------------------------------------------------------------------
digraph G { rankdir=LR; Graphviz->AsciiDoc->HTML}
---------------------------------------------------------------------
livro__1.png
.Com tamanho menor
["graphviz", "sample2x.png", width="60%"]
---------------------------------------------------------------------
digraph automata_0 {
size ="4, 5";
node [shape = circle];
0 [ style = filled, color=lightgrey ];
2 [ shape = doublecircle ];
0 -> 2 [ label = "a " ];
0 -> 1 [ label = "other " ];
1 -> 2 [ label = "a " ];
1 -> 1 [ label = "other " ];
2 -> 2 [ label = "a " ];
2 -> 1 [ label = "other " ];
"Machine: a" [ shape = plaintext ];
}
---------------------------------------------------------------------

Figura 8.3. Com tamanho menor

sample2x.png

["graphviz", "sample3.png", "dot", width="70%"]
---------------------------------------------------------------------
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)" ];
}
---------------------------------------------------------------------
sample3.png

Figura 8.4. Tipo barramento

barramentos.png