File: FAQ.html

package info (click to toggle)
graphviz 1.7.16-2
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 11,124 kB
  • ctags: 12,650
  • sloc: ansic: 131,002; sh: 7,483; makefile: 1,954; tcl: 1,760; yacc: 1,758; perl: 253; awk: 150; lex: 96
file content (316 lines) | stat: -rw-r--r-- 9,268 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<HTML><HEAD><TITLE>Graphviz FAQ 2001-02-10</TITLE>
</HEAD><BODY>
<H1>Graphviz FAQ 2001-02-10</H1>

<A HREF="mailto:north@graphviz.org">Stephen North</A>,
<A HREF="mailto:erg@graphviz.org">Emden Gansner</A>,
<A HREF="mailto:ellson@graphviz.org">John Ellson</A>
<p>
<b>Note</b>:
This is not a tutorial; to understand this you should
know how to use the basic features of the tools and
languages involved. Please see the
<A HREF="http://www.research.att.com/sw/tools/graphviz/refs.html">
user guides</A> for further information.

<h2>General</h2>

Q. <B>Where can I see a list of all the attributes
that control dot or neato?</B>
<P>
See <A HREF="http://www.research.att.com/sw/tools/graphviz/extras/Dot.ref">
Dot.ref</A>.
<p>
Q. <B>Where can I discuss graphviz?</B>
<p>
We have a <tt>graphviz-interest</tt> mailing list.  To join, send a message
to <A HREF="mailto:majordomo@research.att.com">majordomo@research.att.com</A>
containing the line<br>
<pre>subscribe graphviz-interest yourname@host.com</pre>
<p>
We used to have a message board on one of the big content provider
web sites.  We are working on grabbing the old messages and installing
them on our site.
<p>
We don't mind if you register anonymously.
<p>
You can browse an
<A HREF="http://www.research.att.com/lists/graphviz-interest/maillist.html">
online archive</A> of these messages.
<p>
Q. <B>I'm trying to make a dot layout larger. How?</B>
<p>
Magnification isn't directly supported.  We admit this should be fixed.
For now you have to adjust individual
parameters <tt>fontsize, nodesep</tt> and <tt>ranksep</tt>.
For example 
<pre>
           digraph G {
                graph [fontsize=24];
                edge  [fontsize=24];
                node  [fontsize=24];
                ranksep = 1.5;
                nodesep = .25;
                edge [style="setlinewidth(3)"];
                a -> b -> c;
           }
</pre>

If you do this, make sure you are not fighting a conflicting graph
size setting, like <tt>size="6,6"</tt>.
<p>
If you're using Postscript, you can just scale up the output by
manually adding a command such as <tt>2 2 scale</tt> where the
Postscript environment is set up.  Make sure to adjust the
<tt>BoundingBox</tt> too if your tools look at this header.
<p>
Q. <B>I'm trying to make a neato layout larger. How?</B>
<p>
See above regarding font sizes. 
<p>
You can generally push nodes further apart by changing <tt>elen</tt>
(edge lengths).  For example, to make it three times the default:
 
<pre>
        graph G {
           edge [len=3]
           a -- { b c d }
        }
</pre>

<h2>Clusters</h2>

Q. </b> How can I create edges between cluster boxes?</b>
<p>
This only works in graphviz version 1.7 and higher.
To make edges between clusters, first set the
graph attribute <tt>compound=true</tt>.
Then, you can specify a cluster by name as
a <i>logical head or tail</i> to an edge. This will
cause the edge joining the two nodes to be
clipped to the exterior of the box around the
given cluster.
<p>
For example,
 
<pre>
      digraph G {
        compound=true;
        nodesep=1.0;
        subgraph cluster_A {
          a -> b;
          a -> c;
        }
        subgraph cluster_B {
          d -> e;
          f -> e;
        }
        a -> e [ ltail=cluster_A,
                 lhead=cluster_B ];
      }
</pre>

has an edge going from <tt>cluster_A</tt> to
<tt>cluster_B</tt>. If, instead, you say
 
<pre>
        a -> e [ltail=cluster_A];
</pre>
 
this gives you an edge from <tt>cluster_A</tt> to node
<tt>e</tt>. Or you could just specify
an <tt>lhead</tt> attribute.
 
The program warns if a cluster specified as a
logical node is not defined.
Also, if a cluster is specified as a logical
head for an edge, the real
head must be contained in the cluster, and
the real tail must not be.
A similar check is done for logical tails. In
these cases, the edge
is drawn between the real nodes as usual.
<p>
Q.  <B>Clusters are hard to see.</B>
<P>
Set </tt>bgcolor=grey</tt>
(or some other color)
in the cluster.

<H2>Output features</H2>

Q.  <B>I can only get 11x17 output.</B>
<P>
It's not us!  It's probably your printer setup.  If you don't
believe this, run <tt>dot -Tps</tt> and looks for the
<tt>tBoundingBox</tt> header.  The coords are in 1/72ths of an inch.
 
<P>
Q. <B>How do I create special symbols and accents in labels?</B>
<P>
The following solution only works with the
raster drivers that load Truetype or Type1
fonts!  (That means, <tt>-Tgif, -Tpng, -Tjpeg</tt>, and possibly
<tt>-Tbmp</tt> or <tt>-Txbm</tt> if enabled). 
 
Use UTF8 coding, <i>e.g.</i> <verb>&#165;</verb> for the Yen
currency symbol.  Example:
 
      graph G {
            yen [label="&#165;"]
      }
<P>
You can look up other examples in this
handy <A HREF="Gdtclft2.2.5.example.png">
character set reference</A> .
<P>
Q. <B>How do I get font and color changes in record labels or other labels?</B>
<P>
There's no easy way right now.  We're working on it.  Sigh.
 
<P>
Q. <B>In plain format, arrowheads are missing.</B>
It's a bug that may have solidified into a
feature by now.  A workaround is to set
       
<pre>
      edge [dir=none]
</pre>
 
<P>
Q. <B>When I have a red edge it shows up as a
solid red in PNG and GIF formats, but has a
black border when rendered to JPEG.  </B>
<P>
This is an artifact of JPEG's lossy
compression algorithm.  JPEG isn't very good
for line drawings.  PNG is bitmap format of
choice.  John Ellson wants to deprecate and
eventually remove the JPEG driver, but North
is reluctant to change anything that people
might already rely on.
<P>
Q. <B>How can I get custom shapes in my graph?</B>
<P>
Please see the
<A HREF="http://www.research.att.com/sw/tools/graphviz/showhowto.html">
Shape HowTo</A> for some approaches.  There is no easy way to create
custom shapes that work with dot/neato, dotty
(Unix or MS-Windows) and Grappa (the Java
front end), because they don't share any universal back end structure.
We're thinking about it.
<P>
Q. <B> How can I get <some display feature, such
as bold lines> in dotty?</B>
<P>
If it's not there already, there's probably
no easy way to do it except by rolling up
your sleeves and hacking the dotty (lefty
script) code that interprets and renders
graphical attributes.  This is problematic
for the same reason as above: there's no
universal low-level driver layer that is
shared across all the graphviz tools.  Sorry,
we already feel bad about it.
<P>
Q. <B>I already have all the coordinates for the
nodes and edges of my graph and just want to
use dot, neato, or dotty to render it.  How?</B>
<P>
Put the graph with layout attributes into a dot
file. 

Then run <tt>neato -s -nop</tt>, for example:
<pre>
neato -s -nop -Tgif file.dot -o file.gif
</pre>
<P>
Q. <B>I already have all the coordinates for the
nodes, and I want dot or neato to route the edges.</B>
<P>
It's not really too convenient to use dot for this
<P>
Q. <B>I already have all the coordinates for the
nodes and edges of my graph and just want to
use dotty to render it.  How?</B>
<P>

<H2>Problems</H2>

Q. <B>How can I avoid node overlaps in neato?</B>
<P>
<pre>
neato -Goverlap=false
<P>
Q. <B>How can I avoid node-edge overlaps in neato?</B>
<P>
<pre>
neato -Goverlap=false -Gsplines=true -Gsep=.1
<P>
The <tt>sep</tt> argument is the node-edge separation as
a ratio of a node's bounding box. (Don't ask why this
isn't just a constant!)  Note that this option really
slows down neato, so should be used sparingly and only
with modest-sized graphs.
<P>
Q. <B>Neato runs forever on a certain example.</B>
<P>
It could be that your graph is too big, or it could be
that neato is cycling.
Run <tt>neato -v</tt> to observe its progress.
If your graph is small, we have a bug - neato needs an anti-cycling heuristic.
To defeat the bug, you can force neato to run differently to stop earlier
by tactics such as:
<pre>
neato -Gstart=rand
neato -Gepsilon=.01
neato -Gmaxiter=500
</pre>

If it's a large example, the problem is that neato (which is nearly the same
algorithm as multidimensional scaling) iis at least quadratic in time
complexity.  The spline router is even worse: <i>O(N^3)</i>.  So don't run <tt>neato -Groutesplines=true</tt> unless you're willing to pay for it.
<p>
<B>Q. Dot runs forever on a certain example.</B>
<p>
Try dot -v to observe its progress.
<p>
Try 
<p>
Note that it's possible to make graphs whose layout or even parsing
is quadratic in the input size. For example, in dot, 

<pre>
digraph G {
    a -> b -> c -> .... -> x -> y -> z
    a -> z
    b -> z
    c -> z
    /* and so on... */
	x -> z
}
</pre>

The total edge length (therefore the layout time) of
this as a ranked graph is quadratic in the number of nodes.


You probably won't encounter the following, but it is also possible
to construct graphs whose parsing takes quadratic time, by appending
attributes to nodes and edges after the graph has been loaded.
For example:

<pre>
digraph G {
    /* really big graph goes here... */
    n0 -> n1 -> ... -> n999999999;

    n0 [attr0="whatever"]
    n0 [attr1="something else"]
    /* and so on with many more attributes */
}
</pre>
The addition of <tt>attr0</tt> touches every node of the graph.
Then the addition of <tt>attr1</tt> touches every node again, and so on.
</BODY>
</HTML>