Catalogue of the schemas/types/grammars expected by attributes.
The following list gives the legal strings corresponding to values of
the given types.
The syntax for describing legal type strings is a mixture of literal strings,
stdio encodings (e.g., %f for a double), and regular expressions.
For regular expressions, (...)* indicates 0 or more copies of the expression
enclosed in the parentheses, (...)+ indicates 1 or more, and
(...)? denotes 0 or 1 copy.
The examples above show a set of commonly used arrow shapes.
There is a grammar of arrow shapes
which can be used to describe a collection of 3,111,696 arrow combinations of the
42 variations of the primitive set of 11 arrows.
The basic arrows shown
most of the primitive shapes (box, crow, diamond, dot, inv, none, normal, tee, vee)
shapes that can be derived from the grammar (odot, invdot, invodot, obox, odiamond)
shapes supported as special cases for backward-compatibility (ediamond, open, halfopen, empty, invempty).
4 - clusterMode
5 - color
Colors can be specified using one of four formats:
The specification for the RGB and RGBA formats are the format strings used by
sscanf to scan the color value. Thus, these values have the form “#RGB” or
“#RGBA”, where R, G, B, and A each consist of 2 hexadecimal digits, and can
be separated by whitespace. HSV colors have the form of 3 numbers between 0
and 1, separated by whitespace or commas.
String-valued color specifications are case-insensitive and interpreted in
the context of the current color scheme, as specified by the
colorscheme attribute. If this is undefined, the X11 naming
scheme will be used. An initial "/" character can be used to override the
use of the colorscheme attribute. In particular, a single initial "/"
will cause the string to be evaluated using the default X11 naming. If the
color value has the form "/ssss/yyyy", the name yyyy is interpreted using
the schema ssss. If the color scheme name is empty, i.e., the color has the
form "//yyyy", the colorscheme attribute is used. Thus, the forms
"yyyy" and "//yyyy" are equivalent.
The string value transparent can be used to indicate no color. This is only
available in the output formats ps, svg, fig, vmrl, and the bitmap formats.
It can be used whenever a color is needed but is most useful with the
bgcolor attribute. Usually, the same effect can be achieved by
setting style to invis.
6 - colorList
A colon-separated list of weighted color values: WC(:WC)* where each
WC has the form C(;F)? with C a color value and the optional
F a floating-point number, 0 ≤ F ≤ 1. The sum of the floating-point
numbers in a colorList must sum to at most 1.
NOTE: Gradient fills, described below, are currently only available via
*CAIRO or SVG rendering.
If the colorList value specifies multiple colors, with no weights, and a
filled style is specified, a linear gradient fill is done using the first two
colors. If weights are present, a degenerate linear gradient fill is done.
This essentially does a fill using two colors, with the weights specifying
how much of region is filled with each color. If the style
attribute contains the value radial, then a radial gradient fill is done.
These fills work with any shape.
For certain shapes, the style attribute can be set to do fills
using more than 2 colors. See the style type for more
The following table shows some variations of the yellow:blue color list
depending on the style and gradientangle
7 - dirType
For an edge T -> H;
That is, a glyph is drawn at the head end of an edge if and only
if dirType is "forward" or "both";
a glyph is drawn at the tail end of an edge if and only
if dirType is "back" or "both";
For undirected edges T -- H;, one of the nodes, usually
the righthand one, is treated as the head for the purpose of
interpreting "forward" and "back".
8 - double
Double-precision floating point number.
9 - doubleList
A colon-separated list of doubles: "%f(:%f)*"
where each %f is a double.
10 - escString
String with Escape Sequences
A string allowing escape sequences which are replaced according
to the context.
For node attributes, the substring "\N" is replaced by the name of the node,
and the substring "\G" by the name of the graph.
For graph or cluster attributes, the substring "\G" is replaced by the
name of the graph or cluster.
For edge attributes, the substring "\E" is replaced by the name of the edge,
the substring "\G" is replaced by the name of the graph or cluster,
and the substrings "\T" and "\H" by the names of
the tail and head nodes, respectively.
The name of an edge is the string formed from the name of the
tail node, the appropriate edge operator ("--" or "->") and the name of the
In all cases, the substring "\L" is replaced by the object’s label attribute.
In addition, if the associated attribute is
label, headlabel or taillabel,
the escape sequences "\n", "\l" and "\r"
divide the label into lines, centered, left-justified, and right-justified,
Obviously, one can use \\ to get a single backslash. A backslash appearing before any
character not listed above is ignored.
11 - int
12 - layerList
list of strings separated by characters from the layersep
attribute (by default, colons, tabs or spaces), defining layer
names and implicitly numbered 1,2,…
13 - layerRange
specifies a list of layers defined by the layers attribute.
It consists of a list of layer intervals separated by any collection of
characters from the layerlistsep attribute. Each layer
interval is specified as either a layerId or a layerIdslayerId, where
layerId = "all", a decimal integer or a layer name. (An integer i
corresponds to layer i, layers being numbered from 1.)
The string s consists of 1 or more separator characters specified by the
Thus, assuming the default values for layersep and
layerlistsep, if layers="a:b:c:d:e:f:g:h", the
layerRange string layers="a:b,d,f:all" would denote the layers a b d f g h.
These specify the order in which nodes and edges are drawn in concrete
The default "breadthfirst" is the simplest, but when the graph
layout does not avoid edge-node overlap, this mode will sometimes have
edges drawn over nodes and sometimes on top of nodes.
If the mode "nodesfirst" is chosen, all nodes are drawn first, followed by the
edges. This guarantees an edge-node overlap will not be mistaken for
an edge ending at a node.
On the other hand, usually for aesthetic
reasons, it may be desirable that all edges appear beneath nodes, even
if the resulting drawing is ambiguous. This can be achieved by choosing
16 - packMode
The modes "node", "clust" or "graph" specify that the components should be
packed together tightly, using the specified granularity. A value of "node"
causes packing at the node and edge level, with no overlapping of these
objects. This produces a layout with the least area, but it also allows
interleaving, where a node of one component may lie between two nodes in
another component. A value of "graph" does a packing using the bounding box
of the component. Thus, there will be a rectangular region around a component
free of elements of any other component. A value of “clust” guarantees that
top-level clusters are kept intact. What effect a value has also depends on
the layout algorithm. For example, neato does not support clusters, so a
value of "clust" will have the same effect as the default "node" value.
The mode "array(_flag)?(%d)?" indicates that the components should be
packed at the graph level into an array of graphs. By default, the components
are in row-major order, with the number of columns roughly the square root of
the number of components. If the optional flags contains 'c', then
column-major order is used. Finally, if the optional integer suffix is used,
this specifies the number of columns for row-major or the number of rows for
column-major. Thus, the mode "array_c4" indicates array packing, with 4 rows,
starting in the upper left and going down the first column, then down the
second column, etc., until all components are used.
If a graph is smaller than the array cell it occupies, it is centered by
default. The optional flags may contain 't', 'b', 'l', or 'r', indicating
that the graphs should be aligned along the top, bottom, left or right,
If the optional flags contains 'u', this causes the insertion order of
elements in the array to be determined by user-supplied values. Each
component can specify its sort value by a non-negative integer using the
sortv attribute. Components are inserted in order, starting with
the one with the smallest sort value. If no sort value is specified, zero is
17 - pagedir
These specify the 8 row or column major orders for traversing a
rectangular array, the first character corresponding to the major
order and the second to the minor order. Thus, for “BL”, the
major order is from bottom to top, and the minor order is from left
to right. This means the bottom row is traversed first, from left
to right, then the next row up, from left to right, and so on,
until the topmost row is traversed.
18 - point
"%f,%f('!')?" representing the point (x,y). The optional '!' indicates the
node position should not change (input-only).
If dim=3, point may also have the format "%f,%f,%f('!')?"
to represent the point (x,y,z).
19 - pointList
A list of points, separated by spaces.
20 - portPos
modifier indicating where on a node an edge should be aimed. It has the form
portname(:compass_point)? or compass_point. If the first form is
used, the corresponding node must either have record
shape with one of its fields having the given portname, or have an
HTML-like label, one of whose components has a PORT
attribute set to portname.
If a compass point is used, it must have the form
"n","ne","e","se","s","sw","w","nw","c","_". This modifies the edge
placement to aim for the corresponding compass point on the port or, in the
second form where no portname is supplied, on the node itself. The compass
point “c” specifies the center of the node or port. The compass point "_"
specifies that an appropriate side of the port adjacent to the exterior of
the node should be used, if such exists. Otherwise, the center is used. If no
compass point is used with a portname, the default value is "_".
This attribute can be attached to an edge using the
headport and tailport attributes, or as part of the
edge description as in
Note that it is legal to have a portname the same as one of the compass
points. In this case, this reference will be resolved to the port. Thus, if
node A has a port w, then headport=w will refer to the port and not the
compass point. At present, in this case, there is no way to specify that the
compass point should be used.
21 - quadType
Using "fast" gives about a 2-4 times overall speedup compared with "normal",
though layout quality can suffer a little.
22 - rankdir
Corresponding to directed graphs drawn from top to bottom, from left to
right, from bottom to top, and from right to left, respectively.
23 - rankType
24 - rect
The rectangle llx,lly,urx,ury gives the coordinates, in points, of the
lower-left corner (llx,lly) and the upper-right corner (urx,ury).
25 - shape
A string specifying the shape of a node. There are three main
types of shapes:
The record-based shape has largely been superseded and greatly generalized by
HTML-like labels. That is, instead of using shape=record,
consider using shape=none and an HTML-like label.
26 - smoothType
27 - splineType
spline ( ';' spline )*
where spline = (endp)? (startp)? point (triple)+
and triple = point point point
and endp = "e,%f,%f"
and startp = "s,%f,%f"
If a spline has points p₁ p₂ p₃ … pₙ, (n = 1 (mod 3)), the points
correspond to the control points of a cubic B-spline from p₁ to pₙ. If startp
is given, it touches one node of the edge, and the arrowhead
goes from p₁ to startp. If startp is not given, p₁ touches a node.
Similarly for pₙ and endp.
28 - startType
has the syntax (style)?(seed)?.
If style is present, it must be one of the strings "regular", "self",
or "random". In the first case, the nodes are placed regularly about a
circle. In the second case, an abbreviated version of neato is run to obtain
the initial layout. In the last case, the nodes are placed randomly in a unit
If seed is present, it specifies a seed for the random number generator. If
seed is a positive number, this is used as the seed. If it is anything
else, the current time, and possibly the process id, is used to pick a seed,
thereby making the choice more random. In this case, the seed value is stored
in the graph.
If the value is just "random", a time-based seed is chosen.
Note that input positions, specified by a node’s pos attribute, are
only used when the style is "random".
29 - string
Text; a sequence of characters.
30 - style
styleItem ( ',' styleItem )*
name or name'('args')'
name ( ',' name )*
and name can be any string of characters not containing a space, a left or
right parenthesis, or a comma. Whitespace characters are ignored.
NOTE:The styles tapered, striped and wedged are only available in release 2.30 and later.
The recognized style names are,
For nodes and edges:
For edges only:
For nodes only:
The style "radial" is recognized for nodes, clusters and graphs, and indicates a
radial-style gradient fill if applicable.
The style "striped" causes the fill to be done as a set of vertical stripes.
The colors are specified via a colorList, the colors drawn
from left to right in list order. Optional color weights can be specified to
indicate the proportional widths of the bars. If the sum of the weights is
less than 1, the remainder is divided evenly among the colors with no weight.
Note: The style "striped" is only supported with clusters and
The style "wedged" causes the fill to be done as a set of wedges. The colors
are specified via a colorList, with the colors drawn
counter-clockwise starting at angle 0. Optional color weights are interpreted
analogously to the striped case described above. Note: The style "wedged"
is allowed only for elliptically-shaped nodes.
The following tables illustrate some of the effects of the style settings.
Examples of tapered line styles are given below. Examples of linear and
radial gradient fill can be seen under colorList.
Basic style settings for nodes
Basic style settings for edges
Basic style settings for clusters
The effect of style=tapered depends on the penwidth,
dir, arrowhead and arrowtail
attributes. The edge starts with width penwidth and tapers to width 1, in
points. The dir attribute determines whether the tapering goes from tail to
head (dir=forward), from head to tail (dir=forward), from the middle to
both the head and tail (dir=both), or no tapering at all (dir=none). If
the dir is not explicitly set, the default for the graph type is used (see
dir). Arrowheads and arrowtails are also drawn, based on the value
of dir; to avoid this, set arrowhead and/or arrowtail to "none".
Note: At present, the tapered style only allows a simple filled polygon.
Additional styles such as dotted or dashed, or multiple colors supplied
via a colorList are ignored.
The following table illustrates the style=tapered with penwidth=7 and arrowtail=none.
dir \ arrowhead
Additional styles are available in
device-dependent form. Style lists are passed to device drivers, which
can use this to generate appropriate output.
The style attribute affects the basic appearance of nodes, edges and graphs,
but has no effect on any text used in labels. For this, use the
fontname, fontsize and
fontcolor attributes, or the <FONT>, <B>, <I>, etc.
elements in HTML-like labels.
The setlinewidth style value can be used for more control over the width of
node borders and edges than is allowed by bold. This style value takes an
argument, specifying the width of the line in points. For example,
style="bold" is equivalent to style="setlinewidth(2)". The use of
setlinewidth is deprecated; one should use the penwidth
31 - viewPort
"%lf,%lf,%lf,%lf,%lf" or "%lf,%lf,%lf,'%s'"
The viewPort W,H,Z,x,y or W,H,Z,N
specifies a viewport for the final image. The pair (W,H) gives the
dimensions (width and height) of the final image, in
The optional Z is the zoom factor, i.e., the image in the original layout will be
W/Z by H/Z points in size. By default, Z is 1.
The optional last part is either a pair (x,y) giving a position in the original layout of the
points, of the center of the viewport, or the name N
of a node whose center should used as the focus.
By default, the focus is the center of the graph bounding box, i.e.,
(bbx/2,bby/2), where "bbx,bby" is the
value of the bounding box attribute bb.
Sample values: 50,50,.5,'2.8 BSD' or 100,100,2,450,300.
The first will take the 100x100 point square centered on the node 2.8 BSD
and scale it down by 0.5, yielding a 50x50 point final image.