source: rtems-tools/doc/asciidoc/filters/graphviz/asciidoc-graphviz-sample.txt @ f91e023

4.104.115
Last change on this file since f91e023 was f91e023, checked in by Chris Johns <chrisj@…>, on 02/17/14 at 07:04:46

Add the documentation.

  • Property mode set to 100644
File size: 5.9 KB
Line 
1= Graphviz filter for AsciiDoc =
2
3Author: Gouichi Iisaka
4
5Version: 1.1.3
6
7== Introduction ==
8
9The Graphviz(link:http://www.graphviz.org[]) is a way of representing structural information
10as diagrams of abstract graphs and networks.
11
12
13Automatic graph drawing has many important applications
14in software engineering, database and web design, networking,
15and in visual interfaces for many other domains.
16
17Graphviz take descriptions of graphs in a simple text language,
18And has many useful features for concrete diagrams,
19such as options for colors, fonts, tabular node layouts,
20line styles, hyperlinks, and custom shapes.
21
22AsciiDoc can external shell commands used to process Paragraph and
23DelimitedBlock content by Filter.
24
25So now, AsciiDoc can draw graphs via graphviz filter.
26
27== Examples ==
28
29=== Simple ===
30.....................................................................
31[graphviz]
32---------------------------------------------------------------------
33digraph G { rankdir=LR; Graphviz->AsciiDoc->HTML}
34---------------------------------------------------------------------
35.....................................................................
36
37[graphviz]
38---------------------------------------------------------------------
39digraph G { rankdir=LR; Graphviz->AsciiDoc->HTML}
40---------------------------------------------------------------------
41
42=== Using options ===
43.....................................................................
44["graphviz", "sample2.png"]
45---------------------------------------------------------------------
46digraph automata_0 {
47  size ="8.5, 11";
48  node [shape = circle];
49  0 [ style = filled, color=lightgrey ];
50  2 [ shape = doublecircle ];
51  0 -> 2 [ label = "a " ];
52  0 -> 1 [ label = "other " ];
53  1 -> 2 [ label = "a " ];
54  1 -> 1 [ label = "other " ];
55  2 -> 2 [ label = "a " ];
56  2 -> 1 [ label = "other " ];
57  "Machine: a" [ shape = plaintext ];
58}
59---------------------------------------------------------------------
60.....................................................................
61
62["graphviz", "sample2.png"]
63---------------------------------------------------------------------
64digraph automata_0 {
65    size ="8.5, 11";
66    node [shape = circle];
67    0 [ style = filled, color=lightgrey ];
68    2 [ shape = doublecircle ];
69    0 -> 2 [ label = "a " ];
70    0 -> 1 [ label = "other " ];
71    1 -> 2 [ label = "a " ];
72    1 -> 1 [ label = "other " ];
73    2 -> 2 [ label = "a " ];
74    2 -> 1 [ label = "other " ];
75    "Machine: a" [ shape = plaintext ];
76}
77---------------------------------------------------------------------
78
79=== Using Layout ===
80
81.....................................................................
82["graphviz", "sample3.png", "dot"]
83---------------------------------------------------------------------
84digraph finite_state_machine {
85  rankdir=LR;
86  size="8,5"
87  node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
88  node [shape = circle];
89  LR_0 -> LR_2 [ label = "SS(B)" ];
90  LR_0 -> LR_1 [ label = "SS(S)" ];
91  LR_1 -> LR_3 [ label = "S($end)" ];
92  LR_2 -> LR_6 [ label = "SS(b)" ];
93  LR_2 -> LR_5 [ label = "SS(a)" ];
94  LR_2 -> LR_4 [ label = "S(A)" ];
95  LR_5 -> LR_7 [ label = "S(b)" ];
96  LR_5 -> LR_5 [ label = "S(a)" ];
97  LR_6 -> LR_6 [ label = "S(b)" ];
98  LR_6 -> LR_5 [ label = "S(a)" ];
99  LR_7 -> LR_8 [ label = "S(b)" ];
100  LR_7 -> LR_5 [ label = "S(a)" ];
101  LR_8 -> LR_6 [ label = "S(b)" ];
102  LR_8 -> LR_5 [ label = "S(a)" ];
103}
104---------------------------------------------------------------------
105.....................................................................
106
107["graphviz", "sample3.png", "dot"]
108---------------------------------------------------------------------
109digraph finite_state_machine {
110    rankdir=LR;
111    size="8,5"
112    node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
113    node [shape = circle];
114    LR_0 -> LR_2 [ label = "SS(B)" ];
115    LR_0 -> LR_1 [ label = "SS(S)" ];
116    LR_1 -> LR_3 [ label = "S($end)" ];
117    LR_2 -> LR_6 [ label = "SS(b)" ];
118    LR_2 -> LR_5 [ label = "SS(a)" ];
119    LR_2 -> LR_4 [ label = "S(A)" ];
120    LR_5 -> LR_7 [ label = "S(b)" ];
121    LR_5 -> LR_5 [ label = "S(a)" ];
122    LR_6 -> LR_6 [ label = "S(b)" ];
123    LR_6 -> LR_5 [ label = "S(a)" ];
124    LR_7 -> LR_8 [ label = "S(b)" ];
125    LR_7 -> LR_5 [ label = "S(a)" ];
126    LR_8 -> LR_6 [ label = "S(b)" ];
127    LR_8 -> LR_5 [ label = "S(a)" ];
128 }
129---------------------------------------------------------------------
130
131
132== Layout ==
133
134Layout for graphviz as follows.  The default is `dot'.
135
136    *dot;;
137    'dot' draws directed graphs.
138    It works well on DAGs and other graphs that can be drawn as hierarchies.
139    It  reads attributed graph files and writes drawings.
140
141    *neato;;
142    'neato' draws  undirected graphs using ‘‘spring'' models (see Kamada and
143    Kawai, Information Processing Letters 31:1, April 1989).
144    Input  files must be formatted in the dot attributed graph language.
145
146    *twopi;;
147    'twopi'  draws  graphs  using a radial layout (see G. Wills, Symposium on
148    Graph Drawing GD'97, September, 1997).
149    Basically, one node  is  chosen as the center and put at the origin.
150    The remaining nodes are placed on a sequence of concentric circles
151    centered about the origin, each a fixed radial distance from
152    the previous circle.
153
154    *circro;;
155    'circo' draws graphs using a circular layout (see Six and Tollis, GD  '99
156    and  ALENEX  '99, and Kaufmann and Wiese, GD '02.)
157    The tool identifies biconnected components and draws the nodes
158    of the component on  a  circle.
159    The block‐cutpoint tree is then laid out using a recursive radial
160    algorithm.
161    Edge crossings within a circle are minimized by  placing  as
162    many  edges  on  the circle's perimeter as possible.
163    In particular, if the component is outerplanar,
164    the component will have a planar  layout.
165
166    *fdp;;
167     'fdp'  draws undirected graphs using a ‘‘spring'' model.
168     It relies on a force‐directed approach in the spirit of Fruchterman
169     and Reingold
170     (cf.  Software‐Practice & Experience 21(11), 1991, pp. 1129‐1164).
Note: See TracBrowser for help on using the repository browser.