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 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><TITLE>Graphviz FAQ 2006-01-03</TITLE>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
</HEAD><BODY>
<H1>Graphviz FAQ 2006-01-03</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 the following, you should
know how to use the basic features of the tools and
languages involved. Please see the
<A HREF="http://www.graphviz.org/Documentation.php">
user guides and documentation</A> for further information or the
<A HREF="http://www.graphviz.org/Resources.php">resources page</A>
for a partial list of compatible tools and packages.
<h2>General</h2>
<A name=Q1>
<B>Q. Where can I see a list of all the attributes
that control dot or neato?</B>
</A>
<P>
See <A HREF="info/attrs.html">
Graph Attributes</A>. There is also information on
<A HREF="info/command.html">
command-line usage</A> and
<A HREF="info/output.html">
output formats</A>.
<p>
<a name="mailinglist"></a>
<A name=Q2>
<B>Q. Where can I discuss Graphviz?</B>
</A>
<p>
We run a mailing list.
<p>
To subscribe or unsubscribe, visit the
<A HREF="https://mailman.research.att.com/mailman/listinfo/graphviz-interest">graphviz-interest</A> <em>mailman</em> control page. See also the general
<A HREF="http://www.list.org/mailman-member/index.html">
instructions</A> for mailman.
<p>
You can also see the
<A HREF="https://mailman.research.att.com/pipermail/graphviz-interest/">
archive</A>.
<p>
You may wish to use a Yahoo or Hotmail account if you're concerned
about spam. We also run anti-spam filters, and rewrite <tt>@</tt>
as <tt>at</tt> to keep verbatim addresses out of the archive.
<p>
Please, please, please, do not torment the mailing list with beginner's
questions. First, check this FAQ and the
<A HREF="https://mailman.research.att.com/pipermail/graphviz-interest/">
message archive</A> carefully.
Because Graphviz software is made available without charge,
our resources for routine support are very limited.
If you run into software build problems with the ``stable'' release,
you could also try the current <A HREF="http://www.graphviz.org/pub/graphviz/CURRENT/">development snapshot<A>.
If you are desperate, or better yet, if you have constructive advice,
please send a message to the <A HREF="https://mailman.research.att.com/mailman/listinfo/graphviz-devel">graphviz-devel mailing list</A>.
(Note that our local buildlogs are also <A HREF="http://www.graphviz.org/pub/graphviz/ARCHIVE/">online</A>.)
<p>
Also, if a program crashes or you get an abort or something strange occurs
and you are fairly comfortable using the tools:
<UL>
<LI>
Check the
<A HREF="http://www.research.att.com/~erg/graphviz/bugs/openbugs.html"> open
bug list</A> to see if a similar bug has already been reported. You might
also consider checking the
<A HREF="http://www.research.att.com/~erg/graphviz/bugs/buglist.html"> full
bug list</A>, since your bug may have been reported and fixed in the working
version.
<LI>
Submit a <A HREF="http://www.research.att.com/~erg/graphviz/bugform.html">bug
report</A>. If you prefer, you can download a
<A HREF="http://www.research.att.com/~erg/graphviz/bugform.txt">report in
text form</A>, fill in the fields, and email it to
<a href="mailto:gviz-bugs@research.att.com">gviz-bugs@research.att.com</a>.
</UL>
<p>
<A name=Q3>
<B>Q. I'm trying to make a layout larger. How?</B>
</A>
<p>
There are various ways to increase the size of a layout. In doing this,
one has to decide if the sizes of the nodes and text should be
increased as well.
<p>
One approach is to adjust individual
parameters such as <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>, which will then scale
everything back down.
<p>
If you are using fdp or neato, increasing the edge len will tend to
expand the layout.
<pre>
graph G {
edge [len=3]
a -- { b c d }
}
</pre>
For twopi and circo, there are other parameters such as
<tt>ranksep</tt> which can be used. See the
<A HREF="info/attrs.html">
graph attributes</A>.
<p>
You can also use the <tt>ratio</tt> attribute. If you set the <tt>size</tt>
attribute to the desired drawing size, and then set <tt>ratio=fill</tt>, node
positions are scaled separately in x and y until the drawing fills the
specified <tt>size</tt>. Note that node sizes stay the same. If, instead,
you set <tt>ratio=expand</tt>, the layout is uniformly scaled up in x and y
until at least one dimension fits <tt>size</tt>.
<p>
If you specify the <tt>size</tt> attribute but end it with an exclamation
mark (!), the final drawing will be scaled up uniformly in x and y
until at least one dimension fits <tt>size</tt>. Note that everything is
scaled up, including text and node sizes.
<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>
<A name=Q4>
<B>Q. How can I join or merge certain edge routes in dot?</B>
</A>
<p>
You can try running <tt>dot -Gconcentrate=true</tt> or you can
introduce your own virtual nodes drawn as tiny circles where
you want to split or join edges:
<pre>
digraph G {
yourvirtualnode [shape=circle,width=.01,height=.01,label=""];
a -> yourvirtualnode [arrowhead=none]
yourvirtualnode -> {b;c}
}
</pre>
<P>
<b>Q. How can I generate graph layouts in PDF?</b>
<P>
First, create Postscript output, then use an external converter from
Postscript to PDF.
For example,<BR>
<tt>dot -Tps | epsf2pdf -o file.pdf</tt><br>
Note that URL tags are respected, to allow clickable PDF objects.
<P>
If your intention is to use the figure as PDF in some document preparation
system, such as pdflatex, it is very important to use -Tps2 rather than
-Tps. In general, if you really want PDF output, that is, you would like
to have a -Tpdf flag, use -Tps2 before converting to PDF.
<P>
<b>Q. How can I make duplicate nodes?</b>
<P>
Make unique nodes with duplicate labels.
<pre>
digraph G {
node001 [label = "A"];
node002 [label = "A"];
node001 -> node002;
}
</pre>
<P>
<b>Q. How can I set a graph or cluster label without its propagating to all sub-clusters?</b>
<P>
Set the label at the end of the graph (before the closing brace), after all
its contents have been defined. (We admit it seems desirable to define some
special syntax for non-inherited attribute settings.)
<p>
<A name=Q5>
<B>Q. How can I draw multiple parallel edges in neato?</B>
</A>
<p>
This is possible when the <tt>splines</tt> attribute is false, which
is the default. When <tt>splines=true</tt>, we have no good answer but
we are working on it. One trick which is sometimes sufficient is to
specify multiple colors for the edge. This will a produce set of tightly
parallel splines, each in its specified color. Read about the
<A HREF="info/attrs.html#d:color">color
attribute</A> for more information.
<h2>Clusters</h2>
<b>Q. 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>
<A name=Q6>
<B>Q. Clusters are hard to see.</B>
</A>
<P>
Set <tt>bgcolor=grey</tt>
(or some other color)
in the cluster.
<P>
<A name=Q7>
<B>Q. How can I symmetrize (balance) tree layouts?</B>
</A>
<P>
When a tree node has an even number of children, it isn't necessarily
centered above the two middle ones. If you know the order of the children,
a simple hack is to introduce new, invisible middle nodes to re-balance
the layout. The connecting edges should also be invisible. For example:
<pre>
digraph G {
a -> b0;
xb [label="",width=.1,style=invis]
a -> xb [style=invis];
a -> b1;
{rank=same b0 -> xb -> b1 [style=invis]}
b0 -> c0;
xc [label="",width=.1,style=invis]
b0 -> xc [style=invis];
b0 -> c1;
{rank=same c0 -> xc -> c1 [style=invis]}
}
</pre>
This trick really ought to be build into our solver (and made
independent of the order of the children, and available for
layouts other than trees, too).
<H2>Output features</H2>
<A name=Q8>
<B>Q. How can I get high quality (antialiased) output?</B>
</A>
<P>
The easiest thing may be to make the layout in Postscript (option <tt>-Tps</tt>),
then run through <A HREF="http://www.cs.wisc.edu/~ghost/">Ghostview</A> with
antialiasing enabled. The important command line options are
<tt>-dTextAlphaBits=4 -dGraphicsAlphaBits=4</tt>
(4 is the highest level of antialiasing allowed - see the
<A HREF="http://www.cs.wisc.edu/~ghost/doc/GPL/8.15/Use.htm">Ghostview documentation</A>).
The full command line to render a raster could be something like:
<pre>
gs -q -dNOPAUSE -dBATCH -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=png16m -sOutputFile=file.png file.ps
</pre>
<P>
On Mac OS X, the <A HREF="http://www.pixelglow.com/graphviz/">pixelglow</A> port
uses Apple's Quartz renderer, which enables antialiasing. It also provides a beautiful document container for its user interface. (One downside is
that you can't run Pixelglow Graphviz as a web server or other background
process if your Mac has 3D graphics, because Quartz wants to get this resource
to accelerate rendering. Another problem is that as of this writing,
Pixelglow Graphviz hasn't been updated in a long time, maybe mid 2004.)
<P>
On the Linux bleeding edge, Graphviz has an optional plugin to use
the new <A HREF="http://www.cairographics.org">cairo</A> back end,
which is antialiased. If you want to use this, you need to install
cairo, which is not part of graphviz. Cairo can be built from source,
and binary RPMs for Fedora Core 4 are around. Then you need to install
the optional <A HREF="http://www.graphviz.org/pub/graphviz/CURRENT/">graphviz-cairo</A> plugin. It is believed that Cairo
will be part of FC5, so this will become a more standard feature.
<P>
<A name=Q9>
<B>Q. I can only get 11x17 output.</B>
</A>
<P>
It's not us! It's probably your printer setup. If you don't
believe this, run <tt>dot -Tps</tt> and look at the
<tt>BoundingBox</tt> header. The coords are in 1/72ths of an inch.
<P>
<A name=Q10>
<B>Q. How do I create special symbols and accents in labels?</B>
<A name=Q2>
<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> ¥ for the Yen
currency symbol. Example:
graph G {
yen [label="¥"]
}
<P>
You can look up other examples in this
handy <A HREF="http://www.research.att.com/sw/tools/graphviz/doc/char.html">
character set reference</A> .
<P>
<A name=Q11>
<B>Q. How do I get font and color changes in record labels or other labels?</B>
</A>
<P>
This is not possible in record shapes. However, you can do this using
<A HREF="info/shapes.html#html">
HTML-like labels</A>. The granularity of changes is still at the cell level,
but by playing with cell spacing and padding, you can get pretty much
the effect you want. The intention is to support arbitrary font changes
within running text in the not-too-distant future.
<P>
<A name=Q12>
<B>Q. In plain format, splines do not touch the nodes (arrowheads are missing).</B>
</A>
<P>
Edges are specified as the main spline and, if necessary, arrowheads
which actually abut the node. If the arrowheads are not given, drawing
the edge spline will leave a gap between the edge and the node.
This is a bug which has now solidified into a feature.
A workaround is to set
<pre>
edge [dir=none]
</pre>
Since the edges have no arrowheads, the spline specification will go
all the way to both nodes.
<P>
<A name=Q13>
<B>Q. Record nodes are drawn differently in dot and neato when rankdir=LR.</B>
</A>
<P>
It's true. dot -Grankdir=LR rotates record nodes so that their top level
fields are still listed across levels. rankdir=LR has no effect in neato.
One workaround is
<A HREF="info/shapes.html#html">
HTML-like records</A> (they don't rotate; the downside is that
you have to write in XML). Another workaround is to enclose
record labels in { } to rotate/unrotate the record contents. See also,
<A HREF="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnhfact/html/hfactor8_5.asp">How To Avoid Foolish Consistency</A>
by Scott Berkun (Microsoft Corp.)
<P>
<A name=Q14>
<B>Q. How can I print a big graph on multiple pages?</B>
</A>
<P>
The <tt>page</tt> attribute, if set, tells Graphviz to print the
graph as an array of pages of the given size. Thus, the graph
<pre>
digraph G {
page="8.5,11";
...
}
</pre>
will be emitted as 8.5 by 11 inch pages. When printed, the
pages can be tiled to make a drawing of the entire graph.
At present, the feature only works with PostScript output.
<P>
Alternatively, there are various tools and viewers which will take
a large picture and allow you to extract page-size pieces, which can
then be printed.
<P>
<A name=Q15>
<B>Q. 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>
</A>
<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>
<A name=Q16>
<B>Q. How can I get custom shapes or images in my graph?</B>
</A>
<P>
Please see the
<A HREF="http://www.graphviz.org/Documentation/html/shapehowto.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>
<A name=Q17>
<B>Q. Sometimes in dotty, right mouse click shows the global menu
but none of the items can be selected.</B>
</A>
<P>
Check that the NUMLOCK key is off. It's a
<A HREF="http://www.research.att.com/~erg/graphviz/bugs/b524.html">
known bug</A>.
<P>
<A name=Q18>
<B>Q. Why does dotty report a syntax error on a legal dot file?</B>
</A>
Typically this error is reported as:
<pre>
>> graph parser: syntax error near line 14
>> context: >>> <<< digraph G {
>> dotty.lefty: giving up on dot
>> dotty.lefty: graph that causes dot
>> dotty.lefty: to fail has been saved in file dottybug.dot
</pre>
Probably there is a command in your shell environment (such as
.alias or .profile) that does output even for non-interactive shells.
When this occurs, those characters go in the pipe to the dot parser
and cause this problem. An easy check is whether other users have
the same problem.
<P>
<A name=Q20>
<B>Q. How can I get some display feature (such
as bold lines) in dotty?</B>
</A>
<P>
<A NAME="dotty_note">Dotty</A> has not really changed for many years. Therefore, there are
myriad features available in Graphviz which it cannot handle.
In some cases, you can use
<A HREF="http://www.research.att.com/~john/Grappa/">Grappa</A>
or <A HREF="http://www.graphviz.org/webdot/">webdot</A>
for display instead of dotty.
For example, Grappa has generalized polygons
(<tt>node [shape=polygon]</tt>) that dotty lacks.
There are additional interactive viewers available. For example, see
<A HREF="http://www.graphviz.org/Resources.php">Graphical Interfaces</A>
and <A HREF="http://www.graphviz.org/About.php">Viewers</A>. If you
are using Mac OS X, the <A HREF="http://www.pixelglow.com/graphviz/">Mac
version</A> of Graphviz has a highly recommended GUI.
<P>
If the display attribute that you need isn't there already, in dotty,
there's probably no easy way to do it except by rolling up
your sleeves and hacking the dotty code (a lefty script) that
interprets and renders graphical attributes. This is problematic
for the same reason as above: there's no universal low-level driver
layer shared across all the Graphviz tools. We recently added an
intermediate rendering language to the layout tools, but the
various front ends don't use it yet. This would be a good project
for someone who wants to get involved here (along with porting
dotty to GTK.)
<P>
<A name=Q21>
<B>Q. How can I get rid of the little circles on
edges ("edge handles") in dotty?</B>
</A>
<P>
Edit the file dotty.lefty and change the
line that says: 'edgehandles' = 1; to 'edgehandles' = 0;
it's around line 110.
<P>
<A name=Q22>
<B>Q. 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>
</A>
<P>
Put the graph with layout attributes into a dot
file.
Then run <tt>neato -s -n2</tt>. For example:
<pre>
neato -s -n2 -Tgif file.dot -o file.gif
</pre>
Note that if an edge does not have a <TT>pos</TT> attribute
defined, neato will perform whatever edge routing it would
normally do. All of the usual backend attributes (<TT>size</TT>,
<TT>overlap</TT>, <TT>page</TT>, etc.) are available.
<P>
<A name=Q23>
<B>Q. I already have all the coordinates for the
nodes, and I want dot or neato to route the edges.</B>
</A>
<P>
It's not really too convenient to use dot for this.
It is possible to use neato for this,
running neato -s -n For example:
<pre>
neato -s -n -Tgif file.dot -o file.gif
</pre>
neato will use the node positions, but use its technique
for routing the edges. There are several things to note. First,
the neato edge router is different from dot's. Without the built-in
top-down bias, it doesn't do as good a job of avoiding edge overlaps
and, at present, it doesn't handle spline multi-edges at all. Second, by
default, neato uses straight lines as edges. To get spline routing,
you have to specify -Gsplines=true. And this will only work if none of
the nodes overlap. Since the input graph supplies fixed node positions,
it is the user's task to insure this.
<P>
<A name=Q24>
<B>Q. 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>
</A>
<P>
Just run dotty on it. Dotty will use the given pos attributes.
<P>
<A name=Q25>
<B>Q. Same as above, but I have only node coords, not edges.</B>
</A>
<P>
<tt>neato -n</tt> is some help, but neato doesn't handle
spline-based parallel edges.
<P>
<A name=Q26>
<B>Q. How can I make client-side image maps?</B>
</A>
<P>
Use the -Tcmap command line option (only version 1.8.9 and beyond!)
<P>
<A name=Q27>
<B>Q. Why aren't my server-side maps being recognized? I've checked the HTML!</B>
</A>
<P>
Make sure that your server has map files enabled. For example, if running
apache, check that httpd.conf has a line like the following:
<pre>
AddHandler imap-file map
</pre>
and that it is not commented out!
<P>
<A name=Q28>
<B>Q. I've installed Debian Graphviz and it works just fine on the command line,
but when I execute a Perl/CGI script through Apache, no output is generated.
For example, the code</B>
<pre>
<B>system("/usr/local/bin/dot -Tpng /tmp/tree.dot -o /tmp/tree.png");</B>
</pre>
<B>produces no file <tt>/tmp/tree.png</tt>.</B>
</A>
<P>
As best as we can tell, dot dies with no stdout or stderr messages on Debian
systems when run from an Apache cgi program
with no HOME set. The workaround is to provide a HOME directory in the
Apache userid's environment.
<P>
Someone has also suggested using the
<A HREF="http://search.cpan.org/search?query=graphviz&mode=all">
Perl module for Graphviz</A>.
<P>
<A name=Q29>
<B>Q. How can I get 3D output?</B>
</A>
<P>
The Graphviz authors have qualms about the gratuitous use of 3D.
<p>
Nonetheless, dot -Tvrml generates VRML files. There's no Z coordinate
layout - you specify Z coords yourself in the <tt>z</tt> attribute of nodes,
and the Z coordinates of edges are interpolated. If someone
contributes a driver for a newer, more useful format (OpenGL Performer
scene graphs? Open Scene Graphs? Java3D programs?) we'd like to try it.
<p>
neato internally supports layouts in higher dimensions through the <tt>dim</tt>
attribute, e.g. <tt>neato -Gdim=7</tt> but there's no way to get the output
unless you invoke neato as a library and inspect ND_pos(n)[i]
where n is a pointer to the relevant node.
This would need some (minor) driver work and a good 7-dimensional viewer. Well,
<tt>dim=3</tt> ought to be possible.
<H2>Problems</H2>
<A name=Q30>
<B>Q. How can I avoid node overlaps in neato?</B>
</A>
<P>
Use the graph attribute <A HREF="info/attrs.html#d:overlap"><tt>overlap</tt></A>.
<P>
<A name=Q31>
<B>Q. How can I avoid node-edge overlaps in neato?</B>
</A>
<P>
Use the <tt>overlap</tt> attribute to leave room among the nodes, then
use <tt>-Gsplines=true</tt>.
<pre>
neato -Goverlap=... -Gsplines=true -Gsep=.1
</pre>
<P>
The <tt>sep</tt> argument is the node-edge separation as
a ratio of a node's bounding box. That is, <tt>sep=.1</tt> means
each node is treated as though it is 1.1 times larger than it is.
The actual value may require some tinkering.
(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>
<A name=Q32>
<B>Q. Neato runs forever on a certain example.</B>
</A>
<P>
First, how big is your graph? Neato is a quadratic algorithm, roughly
equivalent to statistical multidimensional scaling. If you
feed it a graph with thousands of nodes and edges, it can easily take
hours or days. The first thing to check is to run <tt>neato -v</tt> to
get a trace of the output. If the numbers you see are generally
getting smaller, the layout is just taking a long time. You can set
certain parameters, such as <tt>epsilon</tt> or <tt>maxiter</tt> to
shorten the layout time, at the expense of layout quality. But if your
graph is big, who's going to notice?
<P>
If you see
the numbers repeating, or fluctuating up and down, then neato is
cycling, especially if your graph is small.
This should never happen by default for versions later than 1.13. If it
does, please report it as a bug.
<P>
If you are using an earlier version of neato, or you used <tt>mode=KK</tt>,
cycling is indeed possible. This cycling is very sensitive to the
initial layout. By using the <tt>start</tt> attribute, for example,
<pre>
neato -Gstart=3
neato -Gstart=rand
</pre>
the cycling will most likely disappear. Or you can employ the parameters used
for large graphs to stop the layout earlier:
<pre>
neato -Gepsilon=.01
neato -Gmaxiter=500
</pre>
<P>
Note that, if you have a large graph, the generation of edges as splines
is a cubic algorithm, so you would do well to avoid using <tt>splines=true</tt>.
(This commment applies to circo, fdp and twopi as well.)
<P>
<A name=Q33>
<B>Q. Edge label placement in neato is bad.</b>
</A>
<p>
Difficult problem. We're working on it.
If anyone has some general
label placement code (e.g. a simulated annealer based on the Marks et al.
technique in <I>Graphics Gems IV</I>), please get in touch.
<P>
<A name=Q34>
<B>Q. Dot runs forever on a certain example.</B>
</A>
<p>
Try dot -v to observe its progress.
<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.
<P>
<A name=Q35>
<B>Q. Neato has unnecessary edge crossings, or has missed an
obvious chance to make a much nicer layout.</B>
</A>
<P>
Neato and all similar virtual physical model algorithms rely
on heuristic solutions of optimization problems. The better
the solution, the longer it takes to find. Unfortunately, it
is also possible for these heuristics to get stuck in local
minima. Also, it is heavily influenced by the initial position
of the nodes. It is quite possible that if you run neato again,
but with a different random seed value,
or more iterations, you'll get a better layout. For example:
<pre>
neato -Gstart=5 file.dot -Tps -o file.ps
neato -Gepsilon=.0000001 file.dot -Tps -o file.ps
</pre>
<P>
In particular, note that there are no guarantees that neato will produce
a planar layout of a planar graph, or expose all or most of a graph's
symmetries.
<P>
<A name=Q36>
<B>Q. Webdot doesn't work.</B>
</A>
<P>
We assume you're using Apache and have <A HREF="http://www.tcl.tk/">TCL</A> installed.
If you don't, it's probably better to just use the
<A HREF="http://www.research.att.com/sw/tools/graphviz/webdot.cgi.pl">
webdot perl script</A>.
<P>
To debug webdot, first test whether <tt>tclsh</tt> can load the
Tcldot shared library. Try:
<pre>
$ tclsh
% load <b>$prefix</b>/lib/graphviz/libtcldot.so.0
%
</pre>
where <b>$prefix</b> is the installation prefix for graphviz; usually /usr
or /usr/local.
<p>
Then test whether webdot runs from a shell command. (With webdot we provide
a helper script scaffold.tcl or scaffold.sh that sets up an environment
like the one Apache provides.) For example
<pre>
$ scaffold.tcl >out.gif
can't read "LIBTCLDOT": no such variable
while executing
"file mtime $LIBTCLDOT"
invoked from within
"set t1 [file mtime $LIBTCLDOT]"
(file "cgi-bin/webdot" line 67)
invoked from within
"source cgi-bin/webdot
"
(file "scaffold.tcl" line 22)
</pre>
The above is a strong clue that webdot is not configured properly.
<P>
Finally, test whether webdot runs as a cgi-bin program.
It may help to examine the cgi-bin environment using a
simple cgi-bin tcl script like:
<pre>
#!/bin/env tclsh
puts "Content-type: text/plain"
puts ""
foreach e [lsort [array names env]] {puts "$e: $env($e)"}
</pre>
Save this script as .../cgi-bin/test.tcl, make it executable, then
look at: <a href="http://localhost/cgi-bin/test.tcl">http://localhost/cgi-bin/test.tcl</a>
<P>
<A name=Q37>
<B>Q. I have "Font not found" errors, or text labels missing in webdot.</B>
</A>
<P>
Firstly, recent versions of graphviz will use fontconfig if it is available
on your platform. With fontconfig, this error should not occur, so you
may want to see if an upgrade to graphviz is available, or if a rebuild
will add fontconfig support.
<p>
If fontconfig is not available then graphviz tries to resolve fontnames
to fontpaths itself, and uses DOTFONTPATH (or GDFONTPATH) to indicate where it should look.
<p>
For copyright reasons, Graphviz doesn't come with its own fonts.
On a Windows machine, it knows to search in <tt>C:\Windows\Fonts</tt>.
On a Unix machine, you need to set up a directory that contains
Truetype fonts. You can get a copy of some fonts
<A HREF="http://www.graphviz.org/pub/graphviz/webfonts-1.0-5.noarch.rpm">here</A>.
<P>
The default DOTFONTPATH is:
<pre>
#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"
</pre>
If your fonts are somewhere else, then you must set that directory in
the webdot script, or recompile Graphviz with the correct DEFAULT_FONTPATH
(or set <tt>fontpath="/your/font/directory"</tt> in every graph you lay out,
but that's pretty clumsy.)
<P>
<A name=Q38>
<B>Q. My browser doesn't recognize SVG.</B>
</A>
<P>
The correct MIME type for svg images is: <tt>image/svg+xml</tt> (note "+" not "-").
<P>
SVG is not built into all browsers; you can get
<A HREF="http://www.adobe.com/svg/viewer/install/main.html">plugins</A>
from Adobe for Windows, Linux and some other operating systems.
The <A HREF="http://www.w3.org/Amaya/">Amaya</A> browser from W3C
is said to have builtin SVG.
Firefox 1.5 has a (a href="http://developer.mozilla.org/en/docs/SVG_in_Firefox_1.5">large subset of SVG</A> (somebody please let us know if it can
render graphviz -Tsvg output>.
<A HREF="http://xml.apache.org/batik/">Batik</A> is an SVG
renderer in Java and can be run as a stand-alone program.
<P>
For help with embedding SVG in HTML pages, see
<A HREF="http://www.graphviz.org/webdot/svgembed.html">here</A>.
<P>
<A name=Q39>
<B>Q. libexpat is reported as containing a virus or as a security hole.
Is this a real problem?</B>
</A>
<P>
No, this is a false positive reported by various security software.
See <A HREF="http://www.pcreview.co.uk/forums/thread-1689630.php">http://www.pcreview.co.uk/forums/thread-1689630.php</A> or
<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>.
</BODY>
</HTML>
|