1 | = Graphviz filter for AsciiDoc = |
---|
2 | |
---|
3 | Author: Gouichi Iisaka |
---|
4 | |
---|
5 | Version: 1.1.3 |
---|
6 | |
---|
7 | == Introduction == |
---|
8 | |
---|
9 | The Graphviz(link:http://www.graphviz.org[]) is a way of representing structural information |
---|
10 | as diagrams of abstract graphs and networks. |
---|
11 | |
---|
12 | |
---|
13 | Automatic graph drawing has many important applications |
---|
14 | in software engineering, database and web design, networking, |
---|
15 | and in visual interfaces for many other domains. |
---|
16 | |
---|
17 | Graphviz take descriptions of graphs in a simple text language, |
---|
18 | And has many useful features for concrete diagrams, |
---|
19 | such as options for colors, fonts, tabular node layouts, |
---|
20 | line styles, hyperlinks, and custom shapes. |
---|
21 | |
---|
22 | AsciiDoc can external shell commands used to process Paragraph and |
---|
23 | DelimitedBlock content by Filter. |
---|
24 | |
---|
25 | So now, AsciiDoc can draw graphs via graphviz filter. |
---|
26 | |
---|
27 | == Examples == |
---|
28 | |
---|
29 | === Simple === |
---|
30 | ..................................................................... |
---|
31 | [graphviz] |
---|
32 | --------------------------------------------------------------------- |
---|
33 | digraph G { rankdir=LR; Graphviz->AsciiDoc->HTML} |
---|
34 | --------------------------------------------------------------------- |
---|
35 | ..................................................................... |
---|
36 | |
---|
37 | [graphviz] |
---|
38 | --------------------------------------------------------------------- |
---|
39 | digraph G { rankdir=LR; Graphviz->AsciiDoc->HTML} |
---|
40 | --------------------------------------------------------------------- |
---|
41 | |
---|
42 | === Using options === |
---|
43 | ..................................................................... |
---|
44 | ["graphviz", "sample2.png"] |
---|
45 | --------------------------------------------------------------------- |
---|
46 | digraph 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 | --------------------------------------------------------------------- |
---|
64 | digraph 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 | --------------------------------------------------------------------- |
---|
84 | digraph 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 | --------------------------------------------------------------------- |
---|
109 | digraph 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 | |
---|
134 | Layout 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). |
---|