Graph Attributes


The table below describes the attributes used by various GraphViz tools. The table gives the name of the attribute, the graph components (node, edge, etc.) which use the attribute and the type of the attribute (strings representing legal values of that type). Where applicable, the table also gives a default value for the attribute, a minimum allowed setting for numeric attributes, and certain restrictions on the use of the attribute.

All GraphViz attributes are specified by name-value pairs. Thus, to set the fillcolor of a node abc, one would use
abc [fillcolor = red]
Similarly, to set the arrowhead style of an edge abc -> def, one would use
abc -> def [arrowhead = diamond]
Further details concerning the setting of attributes can be found in the description of the DOT language.

Note: Some attributes, such as dir or arrowtail, are ambiguous when used in DOT with an undirected graph since the head and tail of an edge are meaningless. As a convention, the first time an undirected edge appears, the DOT parser will assign the left node as the tail node and the right node as the head. For example, the edge A -- B will have tail A and head B. It is the user's responsibility to handle such edges consistently. If the edge appears later, in the format
B -- A [taillabel = "tail"]
the drawing will attach the tail label to node A. To avoid possible confusion when such attributes are required, the user is encouraged to use a directed graph. If it is important to make the graph appear undirected, this can be done using the dir, arrowtail or arrowhead attributes.

The tools accept standard C representations for int and double types. For the bool type, TRUE values are represented by "true" (case-insensitive) and any non-zero integer, and FALSE values by "false" (case-insensitive) and zero. In addition, there are a variety of specialized types such as arrowType, color, pointf and rankdir. Legal values for these types are given at the end.

In the Used By field, the characters E, N, G, S and C represent edges, nodes, the root graph, subgraphs and cluster subgraphs, respectively. This field indicates which graph component uses the attribute.


NameUsed ByTypeDefaultMinimumNotes
Damping Gdouble0.990.0neato only
Epsilon Gdouble(.0001 * # nodes)neato only
URL ENGCstring
arrowhead EarrowType normal
arrowsize Edouble1.00.0
arrowtail EarrowType normal
bb Grect write-only
bgcolor GCcolor
bottomlabel Nstring""
center Gboolfalse
clusterrank GclusterMode localdot only
color ENCcolor black
comment ENGstring""
compound Gboolfalsedot only
concentrate Gboolfalsedot only
constraint Ebooltruedot only
decorate Eboolfalse
dim Gint22neato only
dir EdirType forward(directed)
none(undirected)
distortion Ndouble0.0-100.0
fillcolor NCcolor lightgrey(nodes)
black(clusters)
fixedsize Nboolfalse
fontcolor ENGCcolor black
fontname ENGCstring"Times-Roman"
fontpath Gstringsystem-dependent
fontsize ENGCdouble14.01.0
group Nstring""dot only
headURL Estring""
headlabel Estring""
headport EportPos center
height Ndouble0.50.02
label ENGCstring""
"\N" (nodes)
labelangle Edouble-25.0-180.0
labeldistance Edouble1.00.0
labelfloat Eboolfalse
labelfontcolor Ecolor black
labelfontname Estring"Times-Roman"
labelfontsize Edouble11.01.0
labeljust Cstring""dot only
labelloc GCstring"t"(clusters)
"b"(root graphs)
dot only
layer ENlayerRange ""
layers GlayerList ""
len Edouble1.0neato only
lhead Estring""dot only
lp EGCpoint write-only
ltail Estring""dot only
margin Gdouble
pointf
maxiter GintMAXINTneato only
mclimit Gdouble1.0dot only
minlen Eint10dot only
model Gstring""neato only
nodesep Gdouble0.250.02dot only
normalize Gboolfalseneato only
nslimit
nslimit1
Gdoubledot only
ordering Gstring""dot only
orientation Ndouble0.0360.0
orientation Gstring""
overlap Gstring
bool
""neato only
pack Gbool
int
falseneato only
page Gpointf
pagedir Gpagedir BL
pencolor Ccolor black
peripheries Nint0
pin Nboolfalseneato only
pos ENpoint
splineType
quantum Gdouble0.00.0
rank SrankType dot only
rankdir Grankdir TBdot only
ranksep Gdouble0.5(dot)
1.0(twopi)
0.02
ratio Gdouble
string
rects Nrect write-only
regular Nboolfalse
remincross Gboolfalsedot only
rotate Gint0
samehead Estring""dot only
sametail Estring""dot only
samplepoints Gint8
searchsize Gint30dot only
sep Gdouble0.01neato only
shape Nshape ellipse
shapefile Nstring""
showboxes ENGint00dot only
sides Nint40
size Gpointf
skew Ndouble0.0-100.0
splines Gboolfalseneato only
start Gstring
int
""neato only
style ENCstyle
stylesheet Gstring""svg output only
tailURL Estring""
taillabel Estring""
tailport EportPos center
toplabel Nstring""
vertices NpointfList write-only
voro_margin Gdouble0.050.0neato only
weight Edouble1.00(dot)
1(neato)
width Ndouble0.750.01
z Ndouble0.0-MAXFLOAT
-1000

Attribute Descriptions

Damping
Factor damping force motions. On each iteration, a nodes movement is limited to this factor of its potential motion. By being less than 1.0, the system tends to ``cool'', thereby preventing cycling.
Epsilon
Terminating condition. If the length squared of all energy gradients are < Epsilon, the algorithm stops.
URL
Hyperlinks incorporated into device-dependent output. At present, used in ps2, i*map and svg formats. For all these formats, URLs can be attached to nodes, edges and clusters. URL attributes can also be attached to the root graph in ps2 and i*map formats. This serves as the base URL for relative URLs in the former, and as the default image map file in the latter.

The active area for a node or cluster is its bounding box. For edges, the active areas are small circles where the edge contacts its head and tail nodes. These areas may overlap the related node, and the edge URL dominates. If the edge has a label, this will also be active. Finally, if the edge has a head or tail label, this will also be active. Note, however, that if the edge has a headURL attribute, it is this value that is used near the head node and on the head label, if defined. The similar restriction holds when tailURL is defined.

If the URL contains "\N", this is replaced by the name of the node, edge or cluster, where 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 head node. In addition, the URL of an edge may contain "\H", "\T" or "\E". The first two are replaced by the name of the head or tail node, respectively, while the last is a synonym for "\N".

arrowhead
Style of arrowhead on the head node of an edge. See also the dir attribute, and a limitation.
arrowsize
Multiplicative scale factor for arrowheads.
arrowtail
Style of arrowhead on the tail node of an edge. See also the dir attribute, and a limitation.
bb
Bounding box of drawing in integer points.
bgcolor
When attached to the root graph, this color is used as the background for entire canvas. When a cluster attribute, it is used as the initial background for the cluster. If a cluster has a filled style, the cluster's fillcolor will overlay the background color.
bottomlabel
Additional label near bottom of nodes of shape M*.
center
If true, the drawing is centered in the output canvas.
clusterrank
Mode used for handling clusters. If clusterrank is "local", a subgraph whose name begins with "cluster" is given special treatment. The subgraph is laid out separately, and then integrated as a unit into its parent graph, with a bounding rectangle drawn about it. If the cluster has a label parameter, this label is displayed within the rectangle. Note also that there can be clusters within clusters. At present, the modes "global" and "none" appear to be identical, both turning off the special cluster processing.
color
Basic drawing color for graphics.
comment
Comments are inserted into output. Device-dependent
compound
If true, allow edges between clusters. (See lhead and ltail below.)
concentrate
If true, use edge concentrators.
constraint
If false, the edge is not used in ranking the nodes. For example, in the graph
  digraph G {
    a -> c;
    a -> b;
    b -> c [constraint=false];
  }
  
the edge b -> c does not add a constraint during rank assignment, so the only constraints are that a be above b and c, yielding the graph:
decorate
If true, attach edge label to edge by a 2-segment polyline, underlining the label, then going to the closest point of spline.
dim
Set the number of dimensions used for the layout. The maximum value allowed is 10.
dir
Set edge type for drawing arrowheads. This indicates which ends of the edge should be decorated with an arrowhead. The actual style of the arrowhead can be specified using the arrowhead and arrowtail attributes. See limitation.
distortion
Distortion factor for shape=polygon. Positive values cause top part to be larger than bottom; negative values do the opposite.
fillcolor
Color used to fill the background of a node or cluster. If fillcolor is not defined, color is used. (For clusters, if color is not defined, bgcolor is used.) If this is not defined, the default is used, except for shape=point or when the output format is MIF, which use black by default.

Note that a cluster inherits the root graph's attributes if defined. Thus, if the root graph has defined a fillcolor, this will override a color or bgcolor attribute set for the cluster.

fixedsize
If true, the node size is kept fixed and not expanded to contain the text label.
fontcolor
Color used for text.
fontname
Font used for text. This very much depends on the output format and, for non-bitmap output such as PostScript or SVG, the availability of the font when the graph is displayed or printed. As such, it is best to rely on font faces that are generally available, such as Times-Roman, Helvetica or Courier.

The GraphViz tools use True Type fonts for bitmap output. If you specify fontname=schlbk, the tool will look for a file named schlbk.ttf in one of the directories specified by the fontpath attribute.

fontpath
Directory list used by libgd to search for bitmap fonts. If fontpath is not set, the environment variable DOTFONTPATH is checked. If that is not set, GDFONTPATH is checked. If not set, libgd uses its compiled-in font path. Note that fontpath is an attribute of the root graph.
fontsize
Font size, in points, used for text.
group
If the end points of an edge belong to the same group, i.e., have the same group attribute, parameters are set to avoid crossings and keep the edges straight.
headURL
For the output format imap or cmap, if headURL is defined, it is output as part of the head label of the edge. If headURL contains "\N", this will be replaced by the head label text. See limitation.
headlabel
Text label to be placed near head of edge. See limitation.
headport
Indicates where on the head node to attach the head of the edge. In the default case, the edge is aimed towards the center of the node, and then clipped at the node boundary. See limitation.
height
Height of node, in inches.
label
Text label attached to objects. The escape sequences "\n", "\l" and "\r" divide the label into lines, centered, left-justified and right-justified, respectively. The escape sequence "\N" represents a node's name. If a node's shape is record, then the label can have a special format which describes the record layout.
labelangle
Angle, in degrees, that the headlabel(taillabel) is rotated from the angle the edge makes incident with the head(tail) node, respectively.
labeldistance
Multiplicative scaling factor adjusting the distance that the headlabel(taillabel) is the from head(tail) node.
labelfloat
If true, allows edge labels to be less constrained in position. In particular, it may appear on top of other edges.
labelfontcolor
Color used for headlabel and taillabel.
labelfontname
Font used for headlabel and taillabel.
labelfontsize
Font size, in points, used for headlabel and taillabel.
labeljust
Justification for cluster labels. If "r", the label is right-justified within bounding rectangle; otherwise, left-justified.
labelloc
Top/bottom placement of graph and cluster labels. If the attribute is "t", place label at the top; if the attribute is "b", place label at the bottom. By default, root graph labels go on the bottom and cluster labels go on the top.
layer
Specifies layers in which the node or edge is present.
layers
Specifies a linearly ordered list of layer names attached to the graph The graph is then output in separate layers. Only those components belonging to the current output layer appear. For more information, see the page How to use drawing layers (overlays).
len
Preferred edge length, in inches.
lhead
Logical head of an edge. When compound is true, if lhead is defined and is the name of a cluster containing the real head, the edge is clipped to the boundary of the cluster. See limitation.
lp
Label position, in points.
ltail
Logical tail of an edge. When compound is true, if ltail is defined and is the name of a cluster containing the real tail, the edge is clipped to the boundary of the cluster. See limitation.
margin
Set x and y margins of canvas, in inches. In first case, both margins are set equal to the given value.
maxiter
Sets the number of iterations used.
mclimit
Multiplicative scale factor used to alter the MinQuit (default = 8) and MaxIter (default = 24) parameters used during crossing minimization. These correspond to the number of tries without improvement before quitting and the maximum number of iterations in each pass.
minlen
Minimum edge length (rank difference between head and tail).
model
If "circuit", use circuit resistance model to compute dissimilarity values; otherwise, use shortest path model.
nodesep
Minimum space between two adjacent nodes in the same rank, in inches.
normalize
If set, normalize coordinates of final layout so that the first point is at the origin, and then rotate the layout so that the first edge is horizontal.
nslimit ,
nslimit1
Used to set number of iterations in network simplex applications. nslimit is used in computing node x coordinates, nslimit1 for ranking nodes. If defined, # iterations = nslimit(1) * # nodes; otherwise, # iterations = MAXINT.
ordering
If "out" for a graph G, and n is a node in G, then edges n->* appear left-to-right in the same order in which they are defined.
orientation
Angle, in degrees, used to rotate node shapes.
orientation
If "[lL]*", set graph orientation to landscape Used only if rotate is not defined.
overlap
If "scale", remove node overlaps by scaling; if converts to false, remove node overlaps by the Voronoi technique; otherwise, leave overlaps.
pack
This is true if the value of pack is "true" (case-insensitive) or a non-negative integer. If true, each connected component of the graph is laid out separately, and then the graphs are packed tightly. If pack has an integral value, this is used as the size (in points) of a margin around each node; otherwise, a default margin of 8 is used. If pack is interpreted as false, the entire graph is laid out together.
page
Width and height of output pages, in inches. If this is set and is smaller than the size of the layout, a rectangular array of pages of the specified page size is overlaid on the layout, with origins aligned in the lower-left corner, thereby partitioning the layout into pages. The pages are then produced one at a time, in pagedir order.
pagedir
If the page attribute is set and applicable, this attribute specifies the order in which the pages are emitted. This is limited to one of the 8 row or column major orders.
pencolor
Color used to draw the bounding box around a cluster. If pencolor is not defined, color is used. If this is not defined, bgcolor is used. If this is not defined, the default is used.

Note that a cluster inherits the root graph's attributes if defined. Thus, if the root graph has defined a pencolor, this will override a color or bgcolor attribute set for the cluster.

peripheries
Set number of peripheries used in polygonal shapes.
pin
If true and the node has a pos attribute on input, neato prevents the node from moving from the input position. This property can also be specified in the pos attribute itself (cf. the point type).
pos
Position of node, or spline control points, in points. In neato, pos can be used to set initial position of a node. Concerning this, see the -s command line flag.
quantum
If quantum > 0.0, node label dimensions will be rounded to integral multiples of the quantum.
rank
Rank constraints on the nodes in a subgraph. If rank="same", all nodes are placed on the same rank. If rank="min", all nodes are placed on the minimum rank. If rank="source", all nodes are placed on the minimum rank, and the only nodes on the minimum rank belong to some subgraph whose rank attribute is "source" or "min". Analogous criteria hold for rank="max" and rank="sink". (Note: the minimum rank is topmost or leftmost, and the maximum rank is bottommost or rightmost.)
rankdir
Sets direction of graph layout. If rankdir="LR", the graph is laid out from left to right, i.e., directed edges tend to go from left to right. By default, graphs are laid out from top to bottom.
ranksep
In dot, this the gives desired rank separation, in inches. This is the minimum vertical distance between the bottom of the nodes in one rank and the tops of nodes in the next. If the value contains "equally", the centers of all ranks are spaced equally apart. Note that both settings are possible, e.g., ranksep = "1.2 equally". In twopi, specifies radial separation of concentric circles.
ratio
Sets the aspect ratio (drawing height/drawing width) for the drawing. Note that this is adjusted before the size attribute constraints are enforced.

If ratio is numeric, it is taken as the desired aspect ratio. Then, if the actual aspect ratio is less than the desired ratio, the drawing height is scaled up to achieve the desired ratio; if the actual ratio is greater than that desired ratio, the drawing width is scaled up.

If ratio = "fill" and the size attribute is set, node positions are scaled, separately in both x and y, so that the final drawing exactly fills the specified size.

If ratio = "compress" and the size attribute is set, dot attempts to compress the initial layout to fit in the given size. This achieves a tighter packing of nodes but reduces the balance and symmetry. This feature only works in dot.

If ratio = "auto", the page attribute is set and the graph cannot be drawn on a single page, then size is set to an ``ideal'' value. In particular, the size in a given dimension will be the smallest integral multiple of the page size in that dimension which is at least half the current size. The two dimensions are then scaled independently to the new size. This feature only works in dot.

rects
Rectangles for fields of records, in points.
regular
If true, force polygon to be regular.
remincross
If true and there are multiple clusters, run cross minimization a second time.
rotate
If 90, set drawing orientation to landscape.
samehead
Edges with the same head and the same samehead value are aimed at the same point on the head. See limitation.
sametail
Edges with the same tail and the same sametail value are aimed at the same point on the tail. See limitation.
samplepoints
If the input graph defines the vertices attribute, and output is dot or xdot, this give the number of points used to represent circles and ellipses. It plays the same role in neato, when adjusting the layout to avoid overlapping nodes.
searchsize
During network simplex, maximum number of edges with negative cut values to search when looking for one with minimum cut value.
sep
Fraction to increase polygons (multiply coordinates by 1 + sep) for purposes of determining overlap. Guarantees a minimal non-zero distance between nodes.
shape
Set the shape of a node.
shapefile
If non-empty, when output format is ps* or svg* and shape is set to "espf", taken as a filename containing a device-dependent description of a node's shape. If non-empty for bitmap output (gif, jpeg, png, etc.) and shape set to "custom", taken as the URL for a file containing the bitmap image for the node. For files on the local machine, the URL begins with "file://". For remote files, graphviz must have been configured to use a command such as curl to retrieve the files remotely.
showboxes
Print guide boxes in PostScript at the beginning of routesplines if 1, or at the end if 2. (Debugging)
sides
Number of sides if shape=polygon.
size
Maximum width and height of drawing, inches. If defined and the drawing is too large, the drawing is uniformly scaled down so that it fits within the given size. Note that there is some interaction between the size and ratio attributes.
skew
Skew factor for shape=polygon. Positive values skew top of polygon to right; negative to left.
splines
If true, draw edges as splines. This requires non-overlapping nodes (cf. overlap).
start
Parameter used to determine the initial layout of nodes. By default, nodes are randomly placed in a square whose sides have length (# nodes). The same seed is always used for the random number generator, so the initial placement is repeatable. If start converts to an integer, this is used as a seed value for the random number generator. If start is "regular", the nodes are placed regularly about a circle. Finally, if start is defined but is not one of the above cases, the current time is used to pick a seed.
style
Set style for node or edge. For cluster subgraph, if "filled", the cluster box's background is filled.
stylesheet
A URL or pathname specifying an XML style sheet, used in SVG output.
tailURL
When the output format is imap or cmap, if tailURL is defined, it is output as part of the tail label of the edge. If tailURL contains "\N", this will be replaced by the tail label text. See limitation.
taillabel
Text label to be placed near tail of edge. See limitation.
tailport
Indicates where on the tail node to attach the tail of the edge. See limitation.
toplabel
Additional label near top of nodes of shape M*.
vertices
If the input graph defines this attribute, the node is polynomial, and output is dot or xdot, this attribute provides the coordinates of the vertices of the node's polynomial, in inches. If the node is an ellipse or circle, the samplepoints attribute affects the output.
voro_margin
Factor to scale up drawing to allow margin for expansion in Voronoi technique. dim' = (1+2*margin)*dim.
weight
Weight of edge. In dot, the heavier the weight, the shorter, straighter and more vertical the edge is. In neato, the heavier the weight, the more neato will try to place the end points so that the length of the edge is len.
width
Width of node, in inches.
z
Provides z coordinate for the node when output format is VRML.

Attribute Type Descriptions

The following list gives the legal strings corresponding to values of the given types.
arrowType
"normal"
"inv"
"dot" "invdot"
"odot" "invodot"
"none" "tee"
"empty" "invempty"
"diamond" "odiamond"
"ediamond" "crow"
"box" "obox"
"open" "halfopen"
clusterMode
"local","global","none"
color
"#%2x%2x%2x"RGB
"#%2x%2x%2x%2x"RGBA
H[, ]+S[, ]+V0.0 <= H,S,V <= 1.0
stringcolor name
dirType
For an edge T -> H;
"forward" "back"
"both" "none"
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".
layerList
list of strings separated by colons, tabs or spaces, defining layer names and implicitly numbered 1,2,...
layerRange
layerId or layerId[:\t ]layerId,
where layerId = "all", decimal integer or layer name. (An integer i corresponds to layer i.)
pagedir
"BL", "BR", "TL", "TR", "RB", "RT", "LB", "LT". 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.
point
"%d,%d"('!') representing the point (x,y). The optional '!' indicates the node position should not change (input-only).
pointf
"%lf,%lf" representing the point (x,y).
pointfList
list of pointf, separated by spaces.
portPos
":n",":ne",":e",":se",":s",":sw",":w",":nw" These correspond to the obvious compass points on the node.
rankType
"same", "min", "source", "max", "sink"
rankdir
"LR". Any other value corresponds to a top-down layout.
rect
"%d,%d,%d,%d" The rect llx,lly,urx,ury gives the coordinates, in points, of the lower-left corner (llx,lly) and the upper-right corner (urx,ury).
shape
A string specifying the shape of a node. There are three main types of shapes : polygon-based, record-based and PostScript-based.
splineType
spline ( ';' spline )*
where spline=(endp)? (startp)? point (triple)+
and triple=point point point
and endp="e,%d,%d"
and startp="s,%d,%d"
If a spline has points p1 p2 p3 ... pn, (n = 1 (mod 3)), the points correspond to the control points of a B-spline from p1 to pn. If startp is given, it touches one node of the edge, and the arrowhead goes from p1 to startp. If startp is not given, p1 touches a node. Similarly for pn and endp.
style
styleItem ( ',' styleItem )*
where styleItem=name or name'('args')'
and args=name ( ',' name )*
and name=[^)(, ][^)(,]*
At present, the recognized style names comprise "dashed", "dotted", "solid", "invis" and "bold" for nodes and edges, and "filled", "diagonals" and "rounded" for nodes only. Additional styles are available in device-dependent form. Style lists are passed to device drivers, which can use this to generate appropriate output.

Note that, at present, "rounded" cancels "filled", except for circles and ellipses. This holds for the Mrecord shape, which is rounded by definition.