comparison toolboxes/graph_visualisation/share/graphviz/doc/html/FAQ.html @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <HTML><HEAD><TITLE>Graphviz FAQ 2008-06-06</TITLE>
4 <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
5 </HEAD><BODY>
6 <H1>Graphviz FAQ 2008-06-06</H1>
7
8 <A HREF="mailto:gviz-bugs@research.att.com">The Graphviz Project</A>
9 <p>
10 <b>Note</b>:
11 This is not a tutorial; to understand the following, you should
12 know how to use the basic features of the tools and
13 languages involved. Please see the
14 <A HREF="http://www.graphviz.org/Documentation.php">
15 user guides and documentation</A> for further information or the
16 <A HREF="http://www.graphviz.org/Resources.php">resources page</A>
17 for a partial list of compatible tools and packages.
18
19 <h2>General</h2>
20
21 <A name=Q1 HREF=#Q1>
22 <B>Q1</A>. Where can I see a list of all the attributes that control dot or neato?</B>
23
24 </A>
25 <P>
26 See <A HREF="info/attrs.html">
27 Graph Attributes</A>. There is also information on
28 <A HREF="info/command.html">
29 command-line usage</A> and
30 <A HREF="info/output.html">
31 output formats</A>.
32 <p>
33 <a name="mailinglist"></a>
34 <A name=Q2 HREF=#Q2>
35 <B>Q2</A>. Where can I discuss Graphviz?</B>
36
37 <p>
38 We run a mailing list.
39 <p>
40 To subscribe or unsubscribe, visit the
41 <A HREF="https://mailman.research.att.com/mailman/listinfo/graphviz-interest">graphviz-interest</A> <em>mailman</em> control page. See also the general
42 <A HREF="http://www.list.org/mailman-member/index.html">
43 instructions</A> for mailman.
44 <p>
45 You can also see the
46 <A HREF="https://mailman.research.att.com/pipermail/graphviz-interest/">
47 archive</A>.
48 <p>
49 You may wish to use a Yahoo or Hotmail account if you're concerned
50 about spam. We also run anti-spam filters, and rewrite <tt>@</tt>
51 as <tt>at</tt> to keep verbatim addresses out of the archive.
52 <p>
53 Please, please, please, do not torment the mailing list with beginner's
54 questions. First, check this FAQ and the
55 <A HREF="https://mailman.research.att.com/pipermail/graphviz-interest/">
56 message archive</A> carefully.
57 If you are desperate, or better yet, if you have constructive advice,
58 please send a message to the <A HREF="https://mailman.research.att.com/mailman/listinfo/graphviz-devel">graphviz-devel mailing list</A>.
59 <p>
60 Also, if a program crashes or you get an abort or something strange occurs
61 and you are fairly comfortable using the tools:
62 <UL>
63 <LI>
64 Check the
65 <A HREF="http://www.research.att.com/~erg/graphviz/bugs/openbugs.html"> open
66 bug list</A> to see if a similar bug has already been reported. You might
67 also consider checking the
68 <A HREF="http://www.research.att.com/~erg/graphviz/bugs/buglist.html"> full
69 bug list</A>, since your bug may have been reported and fixed in the working
70 version.
71 <LI>
72 Submit a <A HREF="http://www.research.att.com/~erg/graphviz/bugform.html">bug
73 report</A>. If you prefer, you can download a
74 <A HREF="http://www.research.att.com/~erg/graphviz/bugform.txt">report in
75 text form</A>, fill in the fields, and email it to
76 <a href="mailto:gviz-bugs@research.att.com">gviz-bugs@research.att.com</a>.
77 </UL>
78 <p>
79 <A name=Q3 HREF=#Q3>
80 <B>Q3</A>. I'm trying to make a layout larger. How?</B>
81
82 <p>
83 There are various ways to increase the size of a layout. In doing this,
84 one has to decide if the sizes of the nodes and text should be
85 increased as well.
86 <p>
87 One approach is to adjust individual
88 parameters such as <tt>fontsize, nodesep</tt> and <tt>ranksep</tt>.
89 For example,
90 <pre>
91 digraph G {
92 graph [fontsize=24];
93 edge [fontsize=24];
94 node [fontsize=24];
95 ranksep = 1.5;
96 nodesep = .25;
97 edge [style="setlinewidth(3)"];
98 a -&gt; b -&gt; c;
99 }
100 </pre>
101 If you do this, make sure you are not fighting a conflicting graph
102 size setting, like <tt>size="6,6"</tt>, which will then scale
103 everything back down.
104 <p>
105 If you are using fdp or neato, increasing the edge len will tend to
106 expand the layout.
107 <pre>
108 graph G {
109 edge [len=3]
110 a -- { b c d }
111 }
112 </pre>
113 For twopi and circo, there are other parameters such as
114 <tt>ranksep</tt> which can be used. See the
115 <A HREF="info/attrs.html">
116 graph attributes</A>.
117 <p>
118 You can also use the <tt>ratio</tt> attribute. If you set the <tt>size</tt>
119 attribute to the desired drawing size, and then set <tt>ratio=fill</tt>, node
120 positions are scaled separately in x and y until the drawing fills the
121 specified <tt>size</tt>. Note that node sizes stay the same. If, instead,
122 you set <tt>ratio=expand</tt>, the layout is uniformly scaled up in x and y
123 until at least one dimension fits <tt>size</tt>.
124 <p>
125 If you specify the <tt>size</tt> attribute but end it with an exclamation
126 mark (!), the final drawing will be scaled up uniformly in x and y
127 until at least one dimension fits <tt>size</tt>. Note that everything is
128 scaled up, including text and node sizes.
129 <p>
130 If you're using Postscript, you can just scale up the output by
131 manually adding a command such as <tt>2 2 scale</tt> where the
132 Postscript environment is set up. Make sure to adjust the
133 <tt>BoundingBox</tt> too if your tools look at this header.
134 <p>
135 <A name=Q4 HREF=#Q4>
136 <B>Q4</A>. How can I join or merge certain edge routes in dot?</B>
137
138 <p>
139 You can try running <tt>dot -Gconcentrate=true</tt> or you can
140 introduce your own virtual nodes drawn as tiny circles where
141 you want to split or join edges:
142
143 <pre>
144 digraph G {
145 yourvirtualnode [shape=circle,width=.01,height=.01,label=""];
146 a -&gt; yourvirtualnode [arrowhead=none]
147 yourvirtualnode -&gt; {b;c}
148 }
149 </pre>
150
151 <P>
152 <A name=Q4a>
153 <B>Q. How can I generate graph layouts in PDF?</B>
154 </A>
155 <P>
156 Recent versions of graphviz with the CairoPango based drivers
157 can generate PDF directly with the <tt>-Tpdf</tt> command line option.
158 This this first.
159 <P>
160 Otherwise, create Postscript output, then use an external converter from
161 Postscript to PDF.
162 For example,<BR>
163 <tt>dot -Tps | epsf2pdf -o file.pdf</tt><br>
164 Note that URL tags are respected, to allow clickable PDF objects.
165 <P>
166 If your intention is to use the figure as PDF in some document preparation
167 system, such as pdflatex, it is very important to use -Tps2 rather than
168 -Tps. In general, if you really want PDF output, that is, you would like
169 to have a -Tpdf flag, use -Tps2 before converting to PDF.
170 <P>
171 In the diagram below, the shaded nodes will contain bad output.<BR>
172 <IMG src="pspdf.png">
173 <P>
174 <A name=Q4b>
175 <B>Q. How can I make duplicate nodes?</B>
176 </A>
177 <P>
178 Make unique nodes with duplicate labels.
179 <pre>
180 digraph G {
181 node001 [label = "A"];
182 node002 [label = "A"];
183 node001 -&gt; node002;
184 }
185 </pre>
186 <P>
187 <A name=Q4c>
188 <B>Q. How can I set a graph or cluster label without its propagating to all sub-clusters?</B>
189 </A>
190 <P>
191 Set the label at the end of the graph (before the closing brace), after all
192 its contents have been defined. (We admit it seems desirable to define some
193 special syntax for non-inherited attribute settings.)
194 <p>
195 <A name=Q5 HREF=#Q5>
196 <B>Q5</A>. How can I draw multiple parallel edges in neato?</B>
197
198 <p>
199 This is possible when the <tt>splines</tt> attribute is false, which
200 is the default. When <tt>splines=true</tt>, we have no good answer but
201 we are working on it. One trick which is sometimes sufficient is to
202 specify multiple colors for the edge. This will a produce set of tightly
203 parallel splines, each in its specified color. Read about the
204 <A HREF="info/attrs.html#d:color">color
205 attribute</A> for more information.
206
207 <h2>Clusters</h2>
208
209 <A name=Q5a>
210 <B>Q. How can I create edges between cluster boxes?</B>
211 </A>
212 <p>
213 This only works in Graphviz version 1.7 and higher.
214 To make edges between clusters, first set the
215 graph attribute <tt>compound=true</tt>.
216 Then, you can specify a cluster by name as
217 a <i>logical head or tail</i> to an edge. This will
218 cause the edge joining the two nodes to be
219 clipped to the exterior of the box around the
220 given cluster.
221 <p>
222 For example,
223
224 <pre>
225 digraph G {
226 compound=true;
227 nodesep=1.0;
228 subgraph cluster_A {
229 a -&gt; b;
230 a -&gt; c;
231 }
232 subgraph cluster_B {
233 d -&gt; e;
234 f -&gt; e;
235 }
236 a -&gt; e [ ltail=cluster_A,
237 lhead=cluster_B ];
238 }
239 </pre>
240
241 has an edge going from <tt>cluster_A</tt> to
242 <tt>cluster_B</tt>. If, instead, you say
243
244 <pre>
245 a -&gt; e [ltail=cluster_A];
246 </pre>
247
248 this gives you an edge from <tt>cluster_A</tt> to node
249 <tt>e</tt>. Or you could just specify
250 an <tt>lhead</tt> attribute.
251
252 The program warns if a cluster specified as a
253 logical node is not defined.
254 Also, if a cluster is specified as a logical
255 head for an edge, the real
256 head must be contained in the cluster, and
257 the real tail must not be.
258 A similar check is done for logical tails. In
259 these cases, the edge
260 is drawn between the real nodes as usual.
261 <p>
262 <A name=Q6 HREF=#Q6>
263 <B>Q6</A>. Clusters are hard to see.</B>
264
265 <P>
266 Set <tt>bgcolor=grey</tt>
267 (or some other color)
268 in the cluster.
269 <P>
270 <A name=Q7 HREF=#Q7>
271 <B>Q7</A>. How can I symmetrize (balance) tree layouts?</B>
272
273 <P>
274 When a tree node has an even number of children, it isn't necessarily
275 centered above the two middle ones. If you know the order of the children,
276 a simple hack is to introduce new, invisible middle nodes to re-balance
277 the layout. The connecting edges should also be invisible. For example:
278 <pre>
279 digraph G {
280 a -&gt; b0;
281 xb [label="",width=.1,style=invis]
282 a -&gt; xb [style=invis];
283 a -&gt; b1;
284 {rank=same b0 -&gt; xb -&gt; b1 [style=invis]}
285 b0 -&gt; c0;
286 xc [label="",width=.1,style=invis]
287 b0 -&gt; xc [style=invis];
288 b0 -&gt; c1;
289 {rank=same c0 -&gt; xc -&gt; c1 [style=invis]}
290 }
291 </pre>
292 This trick really ought to be build into our solver (and made
293 independent of the order of the children, and available for
294 layouts other than trees, too).
295
296 <H2>Output features</H2>
297
298 <A name=Q8 HREF=#Q8>
299 <B>Q8</A>. How can I get high quality (antialiased) output?</B>
300
301 <P>
302 The easiest thing may be to make the layout in Postscript (option <tt>-Tps</tt>),
303 then run through <A HREF="http://www.cs.wisc.edu/~ghost/">Ghostview</A> with
304 antialiasing enabled. The important command line options are
305 <tt>-dTextAlphaBits=4 -dGraphicsAlphaBits=4</tt>
306 (4 is the highest level of antialiasing allowed - see the
307 <A HREF="http://www.cs.wisc.edu/~ghost/doc/GPL/8.15/Use.htm">Ghostview documentation</A>).
308 The full command line to render a raster could be something like:
309 <pre>
310 gs -q -dNOPAUSE -dBATCH -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=png16m -sOutputFile=file.png file.ps
311 </pre>
312 <P>
313 On Mac OS X, the <A HREF="http://www.pixelglow.com/graphviz/">pixelglow</A> port
314 uses Apple's Quartz renderer, which enables antialiasing. It also provides a beautiful document container for its user interface. (One downside is
315 that you can't run Pixelglow Graphviz as a web server or other background
316 process if your Mac has 3D graphics, because Quartz wants to get this resource
317 to accelerate rendering. Another problem is that as of this writing,
318 Pixelglow Graphviz hasn't been updated in a long time, maybe mid 2004.)
319 <P>
320 On the Linux bleeding edge, Graphviz has an optional plugin to use
321 the <A HREF="http://www.cairographics.org">cairo</A> back end,
322 which has antialiased, path-based graphics. If you want this,
323 you must install cairo, which is not part of Graphviz. Cairo is
324 available in recent versions of Fedora linux, or it can be built
325 from source.
326 <P>
327 <A name=Q9 HREF=#Q9>
328 <B>Q9</A>. I can only get 11x17 output.</B>
329
330 <P>
331 It's not us! It's probably your printer setup. If you don't
332 believe this, run <tt>dot -Tps</tt> and look at the
333 <tt>BoundingBox</tt> header. The coords are in 1/72ths of an inch.
334
335 <P>
336 <A name=Q10 HREF=#Q10>
337 <B>Q10</A>. How do I create special symbols and accents in labels?</B>
338
339 <P>
340 The following solution only works with the
341 raster drivers that load Truetype or Type1
342 fonts! (That means, <tt>-Tgif, -Tpng, -Tjpeg</tt>, and possibly
343 <tt>-Tbmp</tt> or <tt>-Txbm</tt> if enabled).
344
345 Use UTF8 coding, <i>e.g.</i> &amp;#165; for the Yen currency symbol &#165.
346 Example:
347
348 <pre>
349 graph G {
350 yen [label="&amp#165;"]
351 }
352 </pre>
353 <P>
354 You can look up other examples in this handy
355 <A HREF="http://www.graphviz.org/doc/char.html">
356 character set reference</A>.
357 <P>
358 <A name=Q10b>
359 <B>Q. More generally, how do I use non-ASCII character sets?</B>
360 </A>
361 <P>
362 The following applies to Graphviz 2.8 and later. (In older versions
363 of Graphviz, you can sometimes get away with simply putting
364 Latin-1 or other UTF-8 characters in the input stream, but the
365 results are not always correct.)
366 <P>
367 <B>Input:</B> the general idea is to find the
368 <A HREF="http://en.wikipedia.org/wiki/Unicode">Unicode</A>
369 value for the glyph you want, and enter it within a text
370 string "...." or HTML-like label <...>.
371 <P>
372 For example, the mathematical <it>forall</it> sign (&#8704;) has the value 0x2200.
373 There are several ways this can be inserted into a file.
374 One is to write out the ASCII representation: "&amp;#&lt;nnn&gt;;" where &lt;nnn&gt;
375 is the decimal representation of the value. The decimal value of 0x2200 is 8704,
376 so the character can be specified as "&amp;#8704;" . Alternatively, Graphviz
377 accepts UTF-8 encoded input. In the case of forall, its UTF-8 representation
378 is 3 bytes whose decimal values are 226 136 128. For convenience, you
379 would probably enter this using your favorite editor, tuned to your character set
380 of choice. You can then use the <A HREF="http://www.gnu.org/software/libiconv/#TOCdownloading">
381 iconv</A> program to map the graph from your character set to UTF-8 or Latin-1.
382 <P>
383 We also accept the HTML symbolic names for Latin-1 characters as suggested
384 <A HREF="#Q10">above</A>.
385 (Go to http://www.research.att.com/~john/docs/html/index.htm and click
386 on Special symbols and Entities) For example, the cent sign (unicode
387 and Latin-1 value decimal 162 can be inserted as
388 <pre>
389 &amp;cent;
390 </pre>
391 <P>
392 Note that <b>the graph file must always be a plain text document</b>
393 not a Word or other rich format file. Any characters not enclosed in "..."
394 or <...> must be ordinary ASCII characters. In particular, all of the DOT
395 keywords such as <tt>digraph</tt> or <tt>subgraph</tt> must be ASCII.
396 <P>
397 Because we cannot always guess the encoding, you should set the graph
398 attribute <tt>charset</tt> to
399 <A HREF="http://en.wikipedia.org/wiki/UTF-8">UTF-8</A>,
400 <A HREF="http://en.wikipedia.org/wiki/Latin-1">Latin1</A>
401 (alias ISO-8859-1 or ISO-IR-100)
402 or
403 <A HREF="http://en.wikipedia.org/wiki/Big-5">Big-5</A> for
404 Traditional Chinese. This can be done in the graph file or on the command line.
405 For example <tt>charset=Latin1</tt>.
406 <P>
407 <B>Output:</B> It is essential that a font which has the glyphs for your
408 specified characters is available at final rendering time.
409 The choice of this font depends on the target code generator.
410 For the gd-based raster generators (PNG, GIF, etc.) you need a
411 TrueType or Type-1 font file on the machine running the Graphviz program.
412 If Graphviz is built with the <tt>fontconfig</tt>
413 library, it will be used to find the specified font. Otherwise, Graphviz will
414 look in various default directories for the font. The directories to be
415 searched include those specified by the <tt>fontpath</tt> attribute,
416 related environment or shell variables
417 (see the <a href=http://www.graphviz.org/doc/info/attrs.html#d:fontpath>fontpath</A> entry),
418 and known system font directories.
419 The table
420 <A HREF="http://www.graphviz.org/doc/char.html">
421 http://www.graphviz.org/doc/char.html</A>
422 points out that these glyphs are from the <tt>times.ttf</tt> font.
423 With fontconfig, it's hard to specify this font. <tt>Times</tt> usually gets
424 resolved to Adobe Type1 times, which doesn't have all the glyphs seen on that page.)
425 <!--- can someone explain whether Cairo differs from libgd here? --->
426 <P>
427 For Postscript, the input must be either the ASCII subset of UTF-8
428 or Latin-1. (We have looked for more general solutions, but it
429 appears that UTF-8 and Unicode are handled differently for every
430 kind of font type in Postscript, and we don't have time to hack
431 this case-by-case. If someone wants to volunteer to work on this, let us know.)
432 <P>
433 For SVG output, we just pass the raw UTF-8 (or other encoding)
434 straight through to the generated code.
435 <P>
436 Non-ASCII characters probably won't ever work in Grappa
437 or dotty, which have their own back end rendering.
438 (Though, Java supports UTF-8, so there's a chance
439 Grappa also handles raw UTF-8 strings.)
440 <P>
441 As you can see, this is a sad state of affairs.
442 Our plan is to eventually migrate Graphviz to the
443 <A HREF="http://www.pango.org/">pango</A> text formatting
444 library, to ameliorate the worst of these complications.
445 <P>
446 <A name = Q11>
447 <B>Q. How do I get font and color changes in record labels or other labels?</B>
448 </A>
449 <P>
450 This is not possible in record shapes. However, you can do this using
451 <A HREF="info/shapes.html#html">
452 HTML-like labels</A>. The granularity of changes is still at the cell level,
453 but by playing with cell spacing and padding, you can get pretty much
454 the effect you want. The intention is to support arbitrary font changes
455 within running text in the not-too-distant future.
456
457 <P>
458 <A name=Q12 HREF=#Q12>
459 <B>Q12</A>. In plain format, splines do not touch the nodes (arrowheads are missing).</B>
460
461 <P>
462 Edges are specified as the main spline and, if necessary, arrowheads
463 which actually abut the node. If the arrowheads are not given, drawing
464 the edge spline will leave a gap between the edge and the node.
465 This is a bug which has now solidified into a feature.
466 A workaround is to set
467
468 <pre>
469 edge [dir=none]
470 </pre>
471 Since the edges have no arrowheads, the spline specification will go
472 all the way to both nodes.
473 <P>
474 <A name=Q13 HREF=#Q13>
475 <B>Q13</A>. Record nodes are drawn differently in dot and neato when rankdir=LR.</B>
476
477 <P>
478 It's true. dot -Grankdir=LR rotates record nodes so that their top level
479 fields are still listed across levels. rankdir=LR has no effect in neato.
480 One workaround is
481 <A HREF="info/shapes.html#html">
482 HTML-like records</A> (they don't rotate; the downside is that
483 you have to write in XML). Another workaround is to enclose
484 record labels in { } to rotate/unrotate the record contents. See also,
485 <A HREF="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnhfact/html/hfactor8_5.asp">How To Avoid Foolish Consistency</A>
486 by Scott Berkun (Microsoft Corp.)
487 <P>
488 <A name=Q14 HREF=#Q14>
489 <B>Q14</A>. How can I print a big graph on multiple pages?</B>
490
491 <P>
492 The <tt>page</tt> attribute, if set, tells Graphviz to print the
493 graph as an array of pages of the given size. Thus, the graph
494 <pre>
495 digraph G {
496 page="8.5,11";
497 ...
498 }
499 </pre>
500 will be emitted as 8.5 by 11 inch pages. When printed, the
501 pages can be tiled to make a drawing of the entire graph.
502 At present, the feature only works with PostScript output.
503 <P>
504 Alternatively, there are various tools and viewers which will take
505 a large picture and allow you to extract page-size pieces, which can
506 then be printed.
507 <P>
508 <A name=Q15>
509 <B>Q. When I have a red edge it shows up as a
510 solid red in PNG and GIF formats, but has a
511 black border when rendered to JPEG. </B>
512 </A>
513 <P>
514 This is an artifact of JPEG's lossy
515 compression algorithm. JPEG isn't very good
516 for line drawings. PNG is bitmap format of
517 choice. John Ellson wants to deprecate and
518 eventually remove the JPEG driver, but North
519 is reluctant to change anything that people
520 might already rely on.
521 <P>
522 <A name=Q16 HREF=#Q16>
523 <B>Q16</A>. How can I get custom shapes or images in my graph?</B>
524
525 <P>
526 Please see the
527 <A HREF="http://www.graphviz.org/Documentation/html/shapehowto.html">
528 Shape HowTo</A> for some approaches. There is no easy way to create
529 custom shapes that work with dot/neato, dotty
530 (Unix or MS-Windows) and Grappa (the Java
531 front end), because they don't share any universal back end structure.
532 We're thinking about it.
533 <P>
534 <A name=Q17>
535 <B>Q. Sometimes in dotty, right mouse click shows the global menu
536 but none of the items can be selected.</B>
537 </A>
538 <P>
539 Check that the NUMLOCK key is off. It's a
540 <A HREF="http://www.research.att.com/~erg/graphviz/bugs/b524.html">
541 known bug</A>.
542 <P>
543 <A name=Q18 HREF=#Q18>
544 <B>Q18</A>. Why does dotty report a syntax error on a legal dot file?</B>
545
546 <P>
547 Typically this error is reported as:
548 <pre>
549 >> graph parser: syntax error near line 14
550 >> context: >>> <<< digraph G {
551 >> dotty.lefty: giving up on dot
552 >> dotty.lefty: graph that causes dot
553 >> dotty.lefty: to fail has been saved in file dottybug.dot
554 </pre>
555 Probably there is a command in your shell environment (such as
556 .alias or .profile) that does output even for non-interactive shells.
557 When this occurs, those characters go in the pipe to the dot parser
558 and cause this problem. An easy check is whether other users have
559 the same problem.
560 <P>
561 <A name=Q20>
562 <B>Q. How can I get some display feature (such
563 as bold lines) in dotty?</B>
564 </A>
565 <P>
566 <A NAME="dotty_note">Dotty</A> has not really changed for many years. Therefore, there are
567 myriad features available in Graphviz which it cannot handle.
568 In some cases, you can use
569 <A HREF="http://www.research.att.com/~john/Grappa/">Grappa</A>
570 or <A HREF="http://www.graphviz.org/webdot/">webdot</A>
571 for display instead of dotty.
572 For example, Grappa has generalized polygons
573 (<tt>node [shape=polygon]</tt>) that dotty lacks.
574 There are additional interactive viewers available. For example, see
575 <A HREF="http://www.graphviz.org/Resources.php">Graphical Interfaces</A>
576 and <A HREF="http://www.graphviz.org/About.php">Viewers</A>. If you
577 are using Mac OS X, the <A HREF="http://www.pixelglow.com/graphviz/">Mac
578 version</A> of Graphviz has a highly recommended GUI.
579 <P>
580 If the display attribute that you need isn't there already, in dotty,
581 there's probably no easy way to do it except by rolling up
582 your sleeves and hacking the dotty code (a lefty script) that
583 interprets and renders graphical attributes. This is problematic
584 for the same reason as above: there's no universal low-level driver
585 layer shared across all the Graphviz tools. We recently added an
586 intermediate rendering language to the layout tools, but the
587 various front ends don't use it yet. This would be a good project
588 for someone who wants to get involved here (along with porting
589 dotty to GTK.)
590 <P>
591 <A name=Q21>
592 <B>Q. How can I get rid of the little circles on
593 edges ("edge handles") in dotty?</B>
594 </A>
595 <P>
596 Edit the file dotty.lefty and change the
597 line that says: 'edgehandles' = 1; to 'edgehandles' = 0;
598 it's around line 110.
599 <P>
600 <A name=Q22>
601 <B>Q. I already have all the coordinates for the
602 nodes and edges of my graph and just want to
603 use dot, neato, or dotty to render it. How?</B>
604 </A>
605 <P>
606 Put the graph with layout attributes into a dot
607 file.
608
609 Then run <tt>neato -s -n2</tt>. For example:
610 <pre>
611 neato -s -n2 -Tgif file.dot -o file.gif
612 </pre>
613 Note that if an edge does not have a <TT>pos</TT> attribute
614 defined, neato will perform whatever edge routing it would
615 normally do. All of the usual backend attributes (<TT>size</TT>,
616 <TT>overlap</TT>, <TT>page</TT>, etc.) are available.
617 <P>
618 <A name=Q23>
619 <B>Q. I already have all the coordinates for the
620 nodes, and I want dot or neato to route the edges.</B>
621 </A>
622 <P>
623 It's not really too convenient to use dot for this.
624 It is possible to use neato for this,
625 running neato -s -n For example:
626 <pre>
627 neato -s -n -Tgif file.dot -o file.gif
628 </pre>
629 neato will use the node positions, but use its technique
630 for routing the edges. There are several things to note. First,
631 the neato edge router is different from dot's. Without the built-in
632 top-down bias, it doesn't do as good a job of avoiding edge overlaps
633 and, at present, it doesn't handle spline multi-edges at all. Second, by
634 default, neato uses straight lines as edges. To get spline routing,
635 you have to specify -Gsplines=true. And this will only work if none of
636 the nodes overlap. Since the input graph supplies fixed node positions,
637 it is the user's task to insure this.
638 <P>
639 <A name=Q24>
640 <B>Q. I already have all the coordinates for the
641 nodes and edges of my graph and just want to
642 use dotty to render it. How?</B>
643 </A>
644 <P>
645 Just run dotty on it. Dotty will use the given pos attributes.
646 <P>
647 <A name=Q25 HREF=#Q25>
648 <B>Q25</A>. Same as above, but I have only node coords, not edges.</B>
649
650 <P>
651 <tt>neato -n</tt> is some help, but neato doesn't handle
652 spline-based parallel edges.
653 <P>
654 <A name=Q26 HREF=#Q26>
655 <B>Q26</A>. How can I make client-side image maps?</B>
656
657 <P>
658 Use the -Tcmap command line option (only version 1.8.9 and beyond!)
659 <P>
660 <A name=Q27 HREF=#Q27>
661 <B>Q27</A>. Why aren't my server-side maps being recognized? I've checked the HTML!</B>
662
663 <P>
664 Make sure that your server has map files enabled. For example, if running
665 apache, check that httpd.conf has a line like the following:
666 <pre>
667 AddHandler imap-file map
668 </pre>
669 and that it is not commented out!
670 <P>
671 <A name=Q28>
672 <B>Q. I've installed Debian Graphviz and it works just fine on the command line,
673 but when I execute a Perl/CGI script through Apache, no output is generated.</A>
674 For example, the code
675 <tt>
676 system("/usr/local/bin/dot -Tpng /tmp/tree.dot -o /tmp/tree.png");
677 </tt>
678 produces no file <tt>/tmp/tree.png</tt>.</B>
679 <P>
680 As best as we can tell, dot dies with no stdout or stderr messages on Debian
681 systems when run from an Apache cgi program
682 with no HOME set. The workaround is to provide a HOME directory in the
683 Apache userid's environment.
684 <P>
685 Someone has also suggested using the
686 <A HREF="http://search.cpan.org/search?query=graphviz&amp;mode=all">
687 Perl module for Graphviz</A>.
688 <P>
689 <A name=Q29 HREF=#Q29>
690 <B>Q29</A>. How can I get 3D output?</B>
691
692 <P>
693 The Graphviz authors have qualms about the gratuitous use of 3D.
694 <p>
695 Nonetheless, dot -Tvrml generates VRML files. There's no Z coordinate
696 layout - you specify Z coords yourself in the <tt>z</tt> attribute of nodes,
697 and the Z coordinates of edges are interpolated. If someone
698 contributes a driver for a newer, more useful format (OpenGL Performer
699 scene graphs? Open Scene Graphs? Java3D programs?) we'd like to try it.
700 <p>
701 neato internally supports layouts in higher dimensions through the <tt>dim</tt>
702 attribute, e.g. <tt>neato -Gdim=7</tt> but there's no way to get the output
703 unless you invoke neato as a library and inspect ND_pos(n)[i]
704 where n is a pointer to the relevant node.
705 This would need some (minor) driver work and a good 7-dimensional viewer. Well,
706 <tt>dim=3</tt> ought to be possible.
707
708 <H2>Problems</H2>
709 <A name=Q30 HREF=#Q30>
710 <B>Q30</A>. How can I avoid node overlaps in neato?</B>
711
712 <P>
713 Use the graph attribute <A HREF="info/attrs.html#d:overlap"><tt>overlap</tt></A>.
714 <P>
715 <A name=Q31 HREF=#Q31>
716 <B>Q31</A>. How can I avoid node-edge overlaps in neato?</B>
717
718 <P>
719 Use the <tt>overlap</tt> attribute to leave room among the nodes, then
720 use <tt>-Gsplines=true</tt>.
721 <pre>
722 neato -Goverlap=... -Gsplines=true -Gsep=.1
723 </pre>
724 <P>
725 The <tt>sep</tt> argument is the node-edge separation as
726 a ratio of a node's bounding box. That is, <tt>sep=.1</tt> means
727 each node is treated as though it is 1.1 times larger than it is.
728 The actual value may require some tinkering.
729 (Don't ask why this isn't just a constant!) Note that this option really
730 slows down neato, so should be used sparingly and only
731 with modest-sized graphs.
732 <P>
733 <A name=Q32 HREF=#Q32>
734 <B>Q32</A>. Neato runs forever on a certain example.</B>
735
736 <P>
737 First, how big is your graph? Neato is a quadratic algorithm, roughly
738 equivalent to statistical multidimensional scaling. If you
739 feed it a graph with thousands of nodes and edges, it can easily take
740 hours or days. The first thing to check is to run <tt>neato -v</tt> to
741 get a trace of the output. If the numbers you see are generally
742 getting smaller, the layout is just taking a long time. You can set
743 certain parameters, such as <tt>epsilon</tt> or <tt>maxiter</tt> to
744 shorten the layout time, at the expense of layout quality. But if your
745 graph is big, who's going to notice?
746 <P>
747 If you see
748 the numbers repeating, or fluctuating up and down, then neato is
749 cycling, especially if your graph is small.
750 This should never happen by default for versions later than 1.13. If it
751 does, please report it as a bug.
752 <P>
753 If you are using an earlier version of neato, or you used <tt>mode=KK</tt>,
754 cycling is indeed possible. This cycling is very sensitive to the
755 initial layout. By using the <tt>start</tt> attribute, for example,
756 <pre>
757 neato -Gstart=3
758 neato -Gstart=rand
759 </pre>
760 the cycling will most likely disappear. Or you can employ the parameters used
761 for large graphs to stop the layout earlier:
762 <pre>
763 neato -Gepsilon=.01
764 neato -Gmaxiter=500
765 </pre>
766 <P>
767 Note that, if you have a large graph, the generation of edges as splines
768 is a cubic algorithm, so you would do well to avoid using <tt>splines=true</tt>.
769 (This commment applies to circo, fdp and twopi as well.)
770 <P>
771 <A name=Q33 HREF=#Q33>
772 <B>Q33</A>. Edge label placement in neato is bad.</b>
773
774 <p>
775 Difficult problem. We're working on it.
776 If anyone has some general
777 label placement code (e.g. a simulated annealer based on the Marks et al.
778 technique in <I>Graphics Gems IV</I>), please get in touch.
779 <P>
780 <A name=Q34 HREF=#Q34>
781 <B>Q34</A>. Dot runs forever on a certain example.</B>
782
783 <p>
784 Try dot -v to observe its progress.
785 <p>
786 Note that it's possible to make graphs whose layout or even parsing
787 is quadratic in the input size. For example, in dot,
788
789 <pre>
790 digraph G {
791 a -&gt; b -&gt; c -&gt; .... -&gt; x -&gt; y -&gt; z
792 a -&gt; z
793 b -&gt; z
794 c -&gt; z
795 /* and so on... */
796 x -&gt; z
797 }
798 </pre>
799
800 The total edge length (therefore the layout time) of
801 this as a ranked graph is quadratic in the number of nodes.
802
803
804 You probably won't encounter the following, but it is also possible
805 to construct graphs whose parsing takes quadratic time in the number
806 of attributes, by appending attributes to nodes and edges after the
807 graph has been loaded. For example:
808
809 <pre>
810 digraph G {
811 /* really big graph goes here...with N+1 nodes */
812 n0 -&gt; n1 -&gt; ... -&gt; nN;
813
814 n0 [attr0="whatever",
815 attr1="something else",
816 /* and so on with many more attributes */
817 attrM="something again"]
818 }
819 </pre>
820 When an attribute first appears, each object is visited with possible cost
821 proportional to the number of previously declared attributes. Thus,
822 the running time for the above would be <I>cN</I> O(<I>M</I>)
823 for some constant <I>c</I>. If there is any concern about this, the
824 graph should specify the attributes first before declaring nodes or
825 edges. In practice, this problem is neglible.
826 <P>
827 <A name=Q34a>
828 <B>Q. Twopi runs forever on a certain example.</B>
829 </A>
830 <p>
831 Is your graph is large (many thousands of edges),
832 and did you set <pre>splines=true</pre>? It takes
833 a lot of cycles to fit all those splines!
834 <p>
835 <A name=Q35>
836 <B>Q. Neato has unnecessary edge crossings, or has missed an
837 obvious chance to make a much nicer layout.</B>
838 </A>
839 <P>
840 Neato and all similar virtual physical model algorithms rely
841 on heuristic solutions of optimization problems. The better
842 the solution, the longer it takes to find. Unfortunately, it
843 is also possible for these heuristics to get stuck in local
844 minima. Also, it is heavily influenced by the initial position
845 of the nodes. It is quite possible that if you run neato again,
846 but with a different random seed value,
847 or more iterations, you'll get a better layout. For example:
848 <pre>
849 neato -Gstart=5 file.dot -Tps -o file.ps
850 neato -Gepsilon=.0000001 file.dot -Tps -o file.ps
851 </pre>
852 <P>
853 In particular, note that there are no guarantees that neato will produce
854 a planar layout of a planar graph, or expose all or most of a graph's
855 symmetries.
856 <P>
857 <A name=Q36 HREF=#Q36>
858 <B>Q36</A>. Webdot doesn't work.</B>
859
860 <P>
861 We assume you're using Apache and have <A HREF="http://www.tcl.tk/">TCL</A> installed.
862 If you don't, it's probably better to just use the
863 <A HREF="http://www.graphviz.org/Misc/webdot.pl">
864 webdot perl script</A>.
865 <P>
866 To debug webdot, first test whether <tt>tclsh</tt> can load the
867 Tcldot shared library. Try:
868 <pre>
869 $ tclsh
870 % load <b>$prefix</b>/lib/graphviz/libtcldot.so.0
871 %
872 </pre>
873 where <b>$prefix</b> is the installation prefix for graphviz; usually /usr
874 or /usr/local.
875 <p>
876 Then test whether webdot runs from a shell command. (With webdot we provide
877 a helper script scaffold.tcl or scaffold.sh that sets up an environment
878 like the one Apache provides.) For example
879 <pre>
880 $ scaffold.tcl >out.gif
881 can't read "LIBTCLDOT": no such variable
882 while executing
883 "file mtime $LIBTCLDOT"
884 invoked from within
885 "set t1 [file mtime $LIBTCLDOT]"
886 (file "cgi-bin/webdot" line 67)
887 invoked from within
888 "source cgi-bin/webdot
889 "
890 (file "scaffold.tcl" line 22)
891 </pre>
892 The above is a strong clue that webdot is not configured properly.
893 <P>
894 Finally, test whether webdot runs as a cgi-bin program.
895 It may help to examine the cgi-bin environment using a
896 simple cgi-bin tcl script like:
897 <pre>
898 #!/bin/env tclsh
899 puts "Content-type: text/plain"
900 puts ""
901 foreach e [lsort [array names env]] {puts "$e: $env($e)"}
902 </pre>
903 Save this script as .../cgi-bin/test.tcl, make it executable, then
904 look at: <a href="http://localhost/cgi-bin/test.tcl">http://localhost/cgi-bin/test.tcl</a>
905 <P>
906 Also, if you see something like:
907 <pre>
908 WebDot Error:
909
910 Response Code = 403
911 </pre>
912 This usually means that webdot ran succesfully, but was not able
913 to fetch the remote graph from the URL you gave as an argument.
914 The reason is probably that your server is behind a firewall that
915 blocks the webdot server, so it cannot get the graph file.
916 You can either change firewall permissions, put the graph on a
917 different server, or install webdot locally so you don't need a
918 remote server to fetch your graph data.
919 <P>
920 It would be nice if someone hacked webdot to take the contents
921 of a graph as a cgi-bin argument, so it wouldn't need
922 permission to fetch a graph remotely.
923 This is left as an exercise for the Open Source Community.
924 <P>
925 <A name=Q37 HREF=#Q37>
926 <B>Q37</A>. I have "Font not found" errors, or text labels missing in webdot.</B>
927
928 <P>
929 Firstly, recent versions of graphviz will use fontconfig if it is available
930 on your platform. With fontconfig, this error should not occur, so you
931 may want to see if an upgrade to graphviz is available, or if a rebuild
932 will add fontconfig support.
933 <p>
934 If fontconfig is not available then graphviz tries to resolve fontnames
935 to fontpaths itself, and uses DOTFONTPATH (or GDFONTPATH) to indicate where it should look.
936 <p>
937 For copyright reasons, Graphviz doesn't come with its own fonts.
938 On a Windows machine, it knows to search in <tt>C:\Windows\Fonts</tt>.
939 On a Unix machine, you need to set up a directory that contains
940 Truetype fonts. You can get a copy of some fonts
941 <A HREF="http://www.graphviz.org/pub/graphviz/webfonts-1.0-5.noarch.rpm">here</A>.
942 <P>
943 The default DOTFONTPATH is:
944 <pre>
945 #define DEFAULT_FONTPATH "/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1"
946 </pre>
947 If your fonts are somewhere else, then you must set that directory in
948 the webdot script, or recompile Graphviz with the correct DEFAULT_FONTPATH
949 (or set <tt>fontpath="/your/font/directory"</tt> in every graph you lay out,
950 but that's pretty clumsy.)
951 <P>
952 <A name=Q38 HREF=#Q38>
953 <B>Q38</A>. My browser doesn't recognize SVG.</B>
954
955 <P>
956 The correct MIME type for svg images is: <tt>image/svg+xml</tt> (note "+" not "-").
957 <P>
958 SVG is not built into all browsers; you can get
959 <A HREF="http://www.adobe.com/svg/viewer/install/main.html">plugins</A>
960 from Adobe for Windows, Linux and some other operating systems.
961 <A HREF="http://www.mozilla.com/firefox/">
962 Firefox 1.5</A> has a <A href="http://developer.mozilla.org/en/docs/SVG_in_Firefox_1.5">large subset of SVG</A> and renders graphviz -Tsvg output
963 though until graphviz 2.8, the fonts may be too large (thanks for
964 Phil Colbourne at the RailCorp of New South Wales for this advice).
965 <P>
966 For help with embedding SVG in HTML pages, see
967 <A HREF="http://www.graphviz.org/webdot/svgembed.html">here</A>.
968 <P>
969 There are several good standalone viewers and editors for SVG.
970 We like <A HREF="http://www.inkscape.org">inkscape</A>.
971 <A HREF="http://www.gnome.org/projects/evince/">evince</A>
972 is the standard Gnome document viewer that handles SVG, at least
973 since version 0.5 (though Phil C. reports output is blurred)
974 (see also <A HREF="">eog</A> (Eye of Gnome)).
975 Commercial tools like Adobe Illustrator and Microsoft Visio
976 can import SVG (the better to deal with your content, my dear!)
977 If you are using an older (less bloated) Unix system, you
978 may find tools like <A HREF="http://xml.apache.org/batik/">Batik</A>
979 (an SVG renderer in Java) or <A HREF="http://www.sodipodi.com">sodipodi</A>
980 useful, though it seems they are no longer very actively maintained.
981 sodipodi is faster but both make sharp images - isn't that the
982 beauty of path-based graphics?
983 <P>
984 <A name=Q39>
985 <B>Q39. libexpat is reported as containing a virus or as a security hole.
986 Is this a real problem?</B>
987 </A>
988 <P>
989 No, this is a false positive reported by various security software.
990 See <A HREF="http://www.pcreview.co.uk/forums/thread-1689630.php">http://www.pcreview.co.uk/forums/thread-1689630.php</A> or
991 <A HREF="http://spywareblog.com/index.php/2004/11/24/is_libexpat_dll_spyware">http://spywareblog.com/index.php/2004/11/24/is_libexpat_dll_spyware</A>.
992 <P>
993 <A name=Q40 HREF=#Q40>
994 <B>Q40</A>. What is the coordinate transformation between the graph bb and a .png image?</B>
995 <OL>
996 <LI>
997 The bb is expanded by 4 graph-units in all directions (pad) to allow for finite line widths.
998 <LI>
999 Then it is zoomed and/or rotated according to -Gviewport, -Gsize, -Glandscape, -Gorientation options.
1000 At the default scaling of 1:1, one graph unit = 1 point (1/72 inch).
1001 <LI>
1002 Then it is paginated, if requested by -Gpage and if the output format supports it. Not the -Tpng renderer, yet.
1003 <LI>
1004 Then a margin is added, -Gmargin, in absolute units (inches).
1005 The top/bottom margin can be set independently of the left/right margin.
1006 <LI>
1007 Then it is converted to device units, according to -Gdpi,
1008 or a dpi value that is given by the output device,
1009 or a default that is provided by each render.
1010 There are separate dpi values for x and y to allow for non-square pixels.
1011 Some renderers invert the Y axis and need an offset to place the
1012 origin in the top left corner.
1013 The default dpi for -Tpng is 96dpi (approximating the resolution
1014 of most computer monitors) so this is where the scaling by 96/72 (4/3)
1015 comes from.
1016 </OL>
1017 <P>
1018 At the renderer api, plugins have a choice of coordinate representation:
1019 <UL>
1020 <LI>
1021 coordinates in graph-units, and composite transformation data consisting
1022 of: scaling, rotation, and translation. (used by svg, cairo, ps, renderers)
1023 <LI>
1024 coordinates pre-transformed into device units.
1025 </UL>
1026 <P>
1027 <A name=Q41 HREF=#Q41>
1028 <B>Q41</A>. File associations are broken in Mac OSX. Clicking on a <tt>dot</tt> file doesn't open Graphviz.</B>
1029 <p>
1030 The immediate fix is to rebuild the Launch Services database like this:
1031 <p>
1032 1. Trash all other versions of Graphviz.app on your system, except for the just installed one. You can use either of these command lines to find it:
1033 <p>
1034 <pre>locate Graphviz.app</pre>
1035 <p>
1036 or
1037 <p>
1038 <pre>find / -name "Graphviz.app"</pre>
1039 <p>
1040 2. Run the following command line:
1041 <p>
1042 <pre>/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r / </pre>
1043 <p>
1044 or
1045 <p>
1046 <pre>/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r /Applications</pre>
1047 <p>
1048 which deletes the Launch Services database and rebuilds it from existing apps. You may need to sudo to do this.
1049 <p>
1050 3. Verify that the Graphviz.app can now open .dot files and Microsoft Word can still open its own .dot files.
1051 <p>
1052 One artifact of this will be that Microsoft .dot files may appear with the Graphviz document icon. Unfortunately there doesn't seem any a priori way of getting the system to determine whether an arbitrary .dot file belongs to Word or Graphviz -- you can choose which application to open with by right-clicking or control-clicking on the document icon and choosing the app.
1053 <p>
1054 As for why the Launch Services database doesn't automatically register Graphviz,
1055 we're not entirely sure but suspect this only happens if both conditions
1056 hold true:
1057 <p>
1058 A. The user had installed Microsoft Word.<br>
1059 B. There is also another version of Graphviz.app present in the system. (Possibly the previous version 1.13 released by Pixelglow Software)<br>
1060 <A name=Q42 HREF=#Q42><B>Q41</A>. What do all these plugin libraries do?</B>
1061 <p>
1062 <ul>
1063 <li><b>lasi</b> - Adds support for UTF8 characters, beyond ASCII, in postScript output. This table provides a feture comparison of the various PosScript renderers:
1064 <table>
1065 <tr>
1066 <th></th>
1067 <th>UTF8</th>
1068 <th>hyperlinks</th>
1069 <th>human readable PostScript</th>
1070 </tr>
1071 <tr>
1072 <th>-Tps:core</th><td>no</td><td>yes</td><td>++</td>
1073 </tr>
1074 <tr>
1075 <th>-Tps:lasi</th><td>yes</td><td>yes</td><td>+</td>
1076 </tr>
1077 <tr>
1078 <th>-Tps:cairo</th><td>yes</td><td>no</td><td>--</td>
1079 </tr>
1080 </table>
1081 <li><b>gs</b> - Provides support for usershapes in PostScript that can be embedded in all output formats. It interprets the format and renders to a cairo surface. Requires a recent version of ghostscript. (Not needed for PostScript in PostScript)
1082 <li><b>rsvg</b> - Provides support for usershapes in SVG that can be embedded in all output formats. It interprets the format and renders to a cairo surface. (Not needed for SVG in SVG)
1083 <li><b>glitz</b> - OpenGL output. But this may not be the right way to dot it, and my glitz plugin is unfinished. Not useful at this time.
1084 <li><b>ming</b> - Flash output. Was sort of working at one point, not now. Needs development. Might be interesting opportunities for a dynamic graph output. Not useful at this time.
1085 </ul>
1086
1087
1088 </BODY>
1089 </HTML>