Attributes

Instructions to customise the layout of Graphviz nodes, edges, graphs, subgraphs, and clusters.

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.

Note that attribute names are case-sensitive. This is usually true for attribute values as well, unless noted.

All Graphviz attributes are specified by name-value pairs. Thus, to set the color of a node abc, one would use

digraph {
  abc [color = red]
}

Similarly, to set the arrowhead style of an edge abc -> def, one would use:

digraph {
  abc -> def [arrowhead = diamond]
}

Further details concerning the setting of attributes can be found in the description of the DOT language.

At present, most device-independent units are either inches or points, which we take as 72 points per inch.

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

graph {
  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 or yes (case-insensitive) and any non-zero integer, and FALSE values by false or no (case-insensitive) and zero. In addition, there are a variety of specialized types such as arrowType, color, point and rankdir. Legal values for these types are given at the end.

The Used By column field indicates which graph component(s) the attribute applies to.

In the Notes field, an annotation of write only indicates that the attribute is used for output, and is not used or read by any of the layout programs.

Name Used By Type Default Minimum Description, notes
_background Graphs xdot <none> A string in the xdot format specifying an arbitrary background.
area Nodes, Clusters double 1.0 >0 Indicates the preferred area for a node or empty cluster. patchwork only.
arrowhead Edges arrowType normal Style of arrowhead on the head node of an edge.
arrowsize Edges double 1.0 0.0 Multiplicative scale factor for arrowheads.
arrowtail Edges arrowType normal Style of arrowhead on the tail node of an edge.
bb Clusters, Graphs rect Bounding box of drawing in points. write only.
beautify Graphs bool false Whether to draw leaf nodes uniformly in a circle around the root node in sfdp.. sfdp only.
bgcolor Graphs, Clusters color, colorList <none> Canvas background color.
center Graphs bool false Whether to center the drawing in the output canvas.
charset Graphs string "UTF-8" Character encoding used when interpreting string input as a text label..
class Edges, Nodes, Clusters, Graphs string "" Classnames to attach to the node, edge, graph, or cluster's SVG element. svg only.
cluster Clusters, Subgraphs bool false Whether the subgraph is a cluster.
clusterrank Graphs clusterMode local Mode used for handling clusters. dot only.
color Edges, Nodes, Clusters color, colorList black Basic drawing color for graphics, not text.
colorscheme Edges, Nodes, Clusters, Graphs string "" A color scheme namespace: the context for interpreting color names.
comment Edges, Nodes, Graphs string "" Comments are inserted into output.
compound Graphs bool false If true, allow edges between clusters. dot only.
concentrate Graphs bool false If true, use edge concentrators.
constraint Edges bool true If false, the edge is not used in ranking the nodes. dot only.
Damping Graphs double 0.99 0.0 Factor damping force motions.. neato only.
decorate Edges bool false Whether to connect the edge label to the edge with a line.
defaultdist Graphs double 1+(avg. len)*sqrt(|V|) epsilon The distance between nodes in separate connected components. neato only.
dim Graphs int 2 2 Set the number of dimensions used for the layout. neato, fdp, sfdp only.
dimen Graphs int 2 2 Set the number of dimensions used for rendering. neato, fdp, sfdp only.
dir Edges dirType forward (directed)
none (undirected)
Edge type for drawing arrowheads.
diredgeconstraints Graphs string, bool false Whether to constrain most edges to point downwards. neato only.
distortion Nodes double 0.0 -100.0 Distortion factor for shape=polygon.
dpi Graphs double 96.0
0.0
Specifies the expected number of pixels per inch on a display device. bitmap output, svg only.
edgehref Edges escString "" Synonym for edgeURL. map, svg only.
edgetarget Edges escString <none> Browser window to use for the edgeURL link. map, svg only.
edgetooltip Edges escString "" Tooltip annotation attached to the non-label part of an edge. cmap, svg only.
edgeURL Edges escString "" The link for the non-label parts of an edge. map, svg only.
epsilon Graphs double .0001 * # nodes (mode == KK)
.0001 (mode == major)
.01 (mode == sgd)
Terminating condition. neato only.
esep Graphs addDouble, addPoint +3 Margin used around polygons for purposes of spline edge routing. neato, fdp, sfdp, osage, circo, twopi only.
fillcolor Nodes, Edges, Clusters color, colorList lightgrey (nodes)
black (clusters)
Color used to fill the background of a node or cluster.
fixedsize Nodes bool, string false Whether to use the specified width and height attributes to choose node size (rather than sizing to fit the node contents).
fontcolor Edges, Nodes, Graphs, Clusters color black Color used for text.
fontname Edges, Nodes, Graphs, Clusters string "Times-Roman" Font used for text.
fontnames Graphs string "" Allows user control of how basic fontnames are represented in SVG output. svg only.
fontpath Graphs string <system-dependent> Directory list used by libgd to search for bitmap fonts.
fontsize Edges, Nodes, Graphs, Clusters double 14.0 1.0 Font size, in points, used for text.
forcelabels Graphs bool true Whether to force placement of all xlabels, even if overlapping.
gradientangle Nodes, Clusters, Graphs int 0 0 If a gradient fill is being used, this determines the angle of the fill.
group Nodes string "" Name for a group of nodes, for bundling edges avoiding crossings.. dot only.
head_lp Edges point Center position of an edge's head label. write only.
headclip Edges bool true If true, the head of an edge is clipped to the boundary of the head node.
headhref Edges escString "" Synonym for headURL. map, svg only.
headlabel Edges lblString "" Text label to be placed near head of edge.
headport Edges portPos center Indicates where on the head node to attach the head of the edge.
headtarget Edges escString <none> Browser window to use for the headURL link. map, svg only.
headtooltip Edges escString "" Tooltip annotation attached to the head of an edge. cmap, svg only.
headURL Edges escString "" If defined, headURL is output as part of the head label of the edge. map, svg only.
height Nodes double 0.5 0.02 Height of node, in inches.
href Graphs, Clusters, Nodes, Edges escString "" Synonym for URL. map, postscript, svg only.
id Graphs, Clusters, Nodes, Edges escString "" Identifier for graph objects. map, postscript, svg only.
image Nodes string "" Gives the name of a file containing an image to be displayed inside a node.
imagepath Graphs string "" A list of directories in which to look for image files.
imagepos Nodes string "mc" Controls how an image is positioned within its containing node.
imagescale Nodes bool, string false Controls how an image fills its containing node.
inputscale Graphs double <none> Scales the input positions to convert between length units. neato, fdp only.
K Graphs, Clusters double 0.3 0 Spring constant used in virtual physical model. fdp, sfdp only.
label Edges, Nodes, Graphs, Clusters lblString "\N" (nodes)
"" (otherwise)
Text label attached to objects.
label_scheme Graphs int 0 0 Whether to treat a node whose name has the form |edgelabel|* as a special node representing an edge label.. sfdp only.
labelangle Edges double -25.0 -180.0 The angle (in degrees) in polar coordinates of the head & tail edge labels..
labeldistance Edges double 1.0 0.0 Scaling factor for the distance of headlabel / taillabel from the head / tail nodes..
labelfloat Edges bool false If true, allows edge labels to be less constrained in position.
labelfontcolor Edges color black Color used for headlabel and taillabel..
labelfontname Edges string "Times-Roman" Font for headlabel and taillabel.
labelfontsize Edges double 14.0 1.0 Font size of headlabel and taillabel.
labelhref Edges escString "" Synonym for labelURL. map, svg only.
labeljust Graphs, Clusters string "c" Justification for graph & cluster labels.
labelloc Nodes, Graphs, Clusters string "t" (clusters)
"b" (root graphs)
"c" (nodes)
Vertical placement of labels for nodes, root graphs and clusters.
labeltarget Edges escString <none> Browser window to open labelURL links in. map, svg only.
labeltooltip Edges escString "" Tooltip annotation attached to label of an edge. cmap, svg only.
labelURL Edges escString "" If defined, labelURL is the link used for the label of an edge. map, svg only.
landscape Graphs bool false If true, the graph is rendered in landscape mode.
layer Edges, Nodes, Clusters layerRange "" Specifies layers in which the node, edge or cluster is present.
layerlistsep Graphs string "," The separator characters used to split attributes of type layerRange into a list of ranges..
layers Graphs layerList "" A linearly ordered list of layer names attached to the graph.
layerselect Graphs layerRange "" Selects a list of layers to be emitted.
layersep Graphs string ":\t " The separator characters for splitting the layers attribute into a list of layer names..
layout Graphs string "" Which layout engine to use.
len Edges double 1.0 (neato)
0.3 (fdp)
Preferred edge length, in inches. neato, fdp only.
levels Graphs int INT_MAX 0.0 Number of levels allowed in the multilevel scheme. sfdp only.
levelsgap Graphs double 0.0 strictness of neato level constraints. neato only.
lhead Edges string "" Logical head of an edge. dot only.
lheight Graphs, Clusters double Height of graph or cluster label, in inches. write only.
linelength Graphs int 128 60 How long strings should get before overflowing to next line, for text output..
lp Edges, Graphs, Clusters point Label center position. write only.
ltail Edges string "" Logical tail of an edge. dot only.
lwidth Graphs, Clusters double Width of graph or cluster label, in inches. write only.
margin Nodes, Clusters, Graphs double, point <device-dependent> For graphs, this sets x and y margins of canvas, in inches.
maxiter Graphs int 100 * # nodes (mode == KK)
200 (mode == major)
30 (mode == sgd)
600 (fdp)
Sets the number of iterations used. neato, fdp only.
mclimit Graphs double 1.0 Scale factor for mincross (mc) edge crossing minimiser parameters. dot only.
mindist Graphs double 1.0 0.0 Specifies the minimum separation between all nodes. circo only.
minlen Edges int 1 0 Minimum edge length (rank difference between head and tail). dot only.
mode Graphs string major Technique for optimizing the layout. neato only.
model Graphs string shortpath Specifies how the distance matrix is computed for the input graph. neato only.
newrank Graphs bool false Whether to use a single global ranking, ignoring clusters. dot only.
nodesep Graphs double 0.25 0.02 In dot, nodesep specifies the minimum space between two adjacent nodes in the same rank, in inches.
nojustify Graphs, Clusters, Nodes, Edges bool false Whether to justify multiline text vs the previous text line (rather than the side of the container)..
normalize Graphs double, bool false normalizes coordinates of final layout. neato, fdp, sfdp, twopi, circo only.
notranslate Graphs bool false Whether to avoid translating layout to the origin point. neato only.
nslimit Graphs double Sets number of iterations in network simplex applications. dot only.
nslimit1 Graphs double Sets number of iterations in network simplex applications. dot only.
oneblock Graphs bool false Whether to draw circo graphs around one circle.. circo only.
ordering Graphs, Nodes string "" Constrains the left-to-right ordering of node edges.. dot only.
orientation Nodes, Graphs double, string 0.0
""
-360.0 node shape rotation angle, or graph orientation.
outputorder Graphs outputMode breadthfirst Specify order in which nodes and edges are drawn.
overlap Graphs string, bool true Determines if and how node overlaps should be removed. fdp, neato, sfdp, circo, twopi only.
overlap_scaling Graphs double -4 -1e+10 Scale layout by factor, to reduce node overlap.. prism, neato, sfdp, fdp, circo, twopi only.
overlap_shrink Graphs bool true Whether the overlap removal algorithm should perform a compression pass to reduce the size of the layout. prism only.
pack Graphs bool, int false Whether each connected component of the graph should be laid out separately, and then the graphs packed together..
packmode Graphs packMode node How connected components should be packed.
pad Graphs double, point 0.0555 (4 points) Inches to extend the drawing area around the minimal area needed to draw the graph.
page Graphs double, point Width and height of output pages, in inches.
pagedir Graphs pagedir BL The order in which pages are emitted.
pencolor Clusters color black Color used to draw the bounding box around a cluster.
penwidth Clusters, Nodes, Edges double 1.0 0.0 Specifies the width of the pen, in points, used to draw lines and curves.
peripheries Nodes, Clusters int <shape default> (nodes)
1 (clusters)
0 Set number of peripheries used in polygonal shapes and cluster boundaries.
pin Nodes bool false Keeps the node at the node's given input position. neato, fdp only.
pos Edges, Nodes point, splineType Position of node, or spline control points. neato, fdp only.
quadtree Graphs quadType, bool normal Quadtree scheme to use. sfdp only.
quantum Graphs double 0.0 0.0 If quantum > 0.0, node label dimensions will be rounded to integral multiples of the quantum.
rank Subgraphs rankType Rank constraints on the nodes in a subgraph. dot only.
rankdir Graphs rankdir TB Sets direction of graph layout. dot only.
ranksep Graphs double, doubleList 0.5 (dot)
1.0 (twopi)
0.02 Specifies separation between ranks. dot, twopi only.
ratio Graphs double, string Sets the aspect ratio (drawing height/drawing width) for the drawing.
rects Nodes rect Rectangles for fields of records, in points. write only.
regular Nodes bool false If true, force polygon to be regular..
remincross Graphs bool true If there are multiple clusters, whether to run edge crossing minimization a second time.. dot only.
repulsiveforce Graphs double 1.0 0.0 The power of the repulsive force used in an extended Fruchterman-Reingold. sfdp only.
resolution Graphs double 96.0
0.0
Synonym for dpi.. bitmap output, svg only.
root Graphs, Nodes string, bool <none> (graphs)
false (nodes)
Specifies nodes to be used as the center of the layout. twopi, circo only.
rotate Graphs int 0 If rotate=90, sets drawing orientation to landscape.
rotation Graphs double 0 Rotates the final layout counter-clockwise by the specified number of degrees. sfdp only.
samehead Edges string "" Edges with the same head and the same samehead value are aimed at the same point on the head. dot only.
sametail Edges string "" Edges with the same tail and the same sametail value are aimed at the same point on the tail.. dot only.
samplepoints Nodes int 8 (output)
20 (overlap and image maps)
Gives the number of points used for a circle/ellipse node.
scale Graphs double, point Scales layout by the given factor after the initial layout. neato, twopi only.
searchsize Graphs int 30 During network simplex, the maximum number of edges with negative cut values to search when looking for an edge with minimum cut value.. dot only.
sep Graphs addDouble, addPoint +4 Margin to leave around nodes when removing node overlap. fdp, neato, sfdp, osage, circo, twopi only.
shape Nodes shape ellipse Sets the shape of a node.
shapefile Nodes string "" A file containing user-supplied node content.
showboxes Edges, Nodes, Graphs int 0 0 Print guide boxes for debugging. dot only.
sides Nodes int 4 0 Number of sides when shape=polygon.
size Graphs double, point Maximum width and height of drawing, in inches.
skew Nodes double 0.0 -100.0 Skew factor for shape=polygon.
smoothing Graphs smoothType "none" Specifies a post-processing step used to smooth out an uneven distribution of nodes.. sfdp only.
sortv Graphs, Clusters, Nodes int 0 0 Sort order of graph components for ordering packmode packing..
splines Graphs bool, string Controls how, and if, edges are represented.
start Graphs startType "" Parameter used to determine the initial layout of nodes. neato, fdp, sfdp only.
style Edges, Nodes, Clusters, Graphs style "" Set style information for components of the graph.
stylesheet Graphs string "" A URL or pathname specifying an XML style sheet, used in SVG output. svg only.
tail_lp Edges point Position of an edge's tail label, in points.. write only.
tailclip Edges bool true If true, the tail of an edge is clipped to the boundary of the tail node.
tailhref Edges escString "" Synonym for tailURL.. map, svg only.
taillabel Edges lblString "" Text label to be placed near tail of edge.
tailport Edges portPos center Indicates where on the tail node to attach the tail of the edge.
tailtarget Edges escString <none> Browser window to use for the tailURL link. map, svg only.
tailtooltip Edges escString "" Tooltip annotation attached to the tail of an edge. cmap, svg only.
tailURL Edges escString "" If defined, tailURL is output as part of the tail label of the edge. map, svg only.
target Edges, Nodes, Graphs, Clusters escString, string <none> If the object has a URL, this attribute determines which window of the browser is used for the URL.. map, svg only.
TBbalance Graphs string '' Which rank to move floating (loose) nodes to. dot only.
tooltip Nodes, Edges, Clusters, Graphs escString "" Tooltip (mouse hover text) attached to the node, edge, cluster, or graph. cmap, svg only.
truecolor Graphs bool Whether internal bitmap rendering relies on a truecolor color model or uses. bitmap output only.
URL Edges, Nodes, Graphs, Clusters escString <none> Hyperlinks incorporated into device-dependent output. map, postscript, svg only.
vertices Nodes pointList Sets the coordinates of the vertices of the node's polygon, in inches. write only.
viewport Graphs viewPort "" Clipping window on final drawing.
voro_margin Graphs double 0.05 0.0 Tuning margin of Voronoi technique. neato, fdp, sfdp, twopi, circo only.
weight Edges int, double 1 0(dot,twopi)
1(neato,fdp)
Weight of edge.
width Nodes double 0.75 0.01 Width of node, in inches.
xdotversion Graphs string Determines the version of xdot used in output. xdot only.
xlabel Edges, Nodes lblString "" External label for a node or edge.
xlp Nodes, Edges point Position of an exterior label, in points. write only.
z Nodes double 0.0 -MAXFLOAT
-1000
Z-coordinate value for 3D layouts and displays.

_background

A string in the xdot format specifying an arbitrary background

type: xdot, default: <none>

During rendering, the canvas is first filled as described in the bgcolor attribute.

Then, if _background is defined, the graphics operations described in the string are performed on the canvas.

See xdot format page for more information.

Render a red square in the background
digraph G {
  _background="c 7 -#ff0000 p 4 4 4 36 4 36 36 4 36";
  a -> b
}
Valid on:
  • Graphs

Search the Graphviz codebase for "_background"

area

Indicates the preferred area for a node or empty cluster

type: double, default: 1.0, minimum: >0

Example: Australian Coins, area proportional to value
graph {
  layout="patchwork"
  node [style=filled]
  "5c"  [area=  5 fillcolor=silver]
  "10c" [area= 10 fillcolor=silver]
  "20c" [area= 20 fillcolor=silver]
  "50c" [area= 50 fillcolor=silver]
  "$1"  [area=100 fillcolor=gold]
  "$2"  [area=200 fillcolor=gold]
}
Valid on:
  • Nodes
  • Clusters

Note: patchwork only.

Search the Graphviz codebase for "area"

arrowhead

Style of arrowhead on the head node of an edge

type: arrowType, default: normal

This will only appear if the dir attribute is forward or both.

See the limitation.

See also:

Valid on:
  • Edges

Search the Graphviz codebase for "arrowhead"

arrowsize

Multiplicative scale factor for arrowheads

type: double, default: 1.0, minimum: 0.0

Example
digraph {
  quiver -> "0.5" [arrowsize=0.5]
  quiver -> "1"
  quiver -> "2" [arrowsize=2]
  quiver -> "3" [arrowsize=3]
}
Valid on:
  • Edges

Search the Graphviz codebase for "arrowsize"

arrowtail

Style of arrowhead on the tail node of an edge

type: arrowType, default: normal

This will only appear if the dir attribute is back or both.

See the limitation.

See also:

Valid on:
  • Edges

Search the Graphviz codebase for "arrowtail"

bb

Bounding box of drawing in points

type: rect

Valid on:
  • Clusters
  • Graphs

Note: write only.

Search the Graphviz codebase for "bb"

beautify

Whether to draw leaf nodes uniformly in a circle around the root node in sfdp.

type: bool, default: false

Whether to try to draw leaf nodes uniformly on a circle around the root node.

Prior to Graphviz 8.0.1, this is affected by Issue 2283: rendering one fewer sector than necessary, overlapping the first and last nodes.

Examples:

Beautify
digraph G {
    layout="sfdp"
    beautify=true

    N0 -> {N1; N2; N3; N4; N5; N6}
}
No beautify
digraph G {
    layout="sfdp"
    beautify=false

    N0 -> {N1; N2; N3; N4; N5; N6}
}
Valid on:
  • Graphs

Note: sfdp only.

Search the Graphviz codebase for "beautify"

bgcolor

Canvas background color

type: color | colorList, default: <none>

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.

If the value is a colorList, a gradient fill is used. By default, this is a linear fill; setting style=radial will cause a radial fill. Only two colors are used. If the second color (after a colon) is missing, the default color is used for it. See also the gradientangle attribute for setting the gradient angle.

For certain output formats, such as PostScript, no fill is done for the root graph unless bgcolor is explicitly set.

For bitmap formats, however, the bits need to be initialized to something, so the canvas is filled with white by default. This means that if the bitmap output is included in some other document, all of the bits within the bitmap's bounding box will be set, overwriting whatever color or graphics were already on the page. If this effect is not desired, and you only want to set bits explicitly assigned in drawing the graph, set bgcolor="transparent".

Example
graph {
  bgcolor="lightblue"
  label="Home"
  subgraph cluster_ground_floor {
    bgcolor="lightgreen"
    label="Ground Floor"
    Lounge
    Kitchen
  }
  subgraph cluster_top_floor {
    bgcolor="lightyellow"
    label="Top Floor"
    Bedroom
    Bathroom
  }
}
Valid on:
  • Graphs
  • Clusters

Search the Graphviz codebase for "bgcolor"

center

Whether to center the drawing in the output canvas

type: bool, default: false

Can be true or false.

Valid on:
  • Graphs

Search the Graphviz codebase for "center"

charset

Character encoding used when interpreting string input as a text label.

type: string, default: "UTF-8"

The default value is "UTF-8". The other legal values are:

  • "utf-8" / "utf8" (default value)
  • "iso-8859-1" / "ISO_8859-1" / "ISO8859-1" / "ISO-IR-100" / "Latin1" / "l1" / "latin-1"
  • "big-5" / "big5": the Big-5 Chinese encoding

The charset attribute is case-insensitive.

Note that if the character encoding used in the input does not match the charset value, the resulting output may be very strange.

Example
digraph G {
  charset="UTF-8"
  "🍔" -> "💩"
}
Valid on:
  • Graphs

Search the Graphviz codebase for "charset"

class

Classnames to attach to the node, edge, graph, or cluster's SVG element

type: string, default: ""

Combine with stylesheet for styling SVG output using CSS classnames.

Multiple space-separated classes are supported.

See also:

Example:

digraph G {
  graph [class="cats"];

  subgraph cluster_big {
    graph [class="big_cats"];

    "Lion" [class="yellow social"];
    "Snow Leopard" [class="white solitary"];
  }
}
Valid on:
  • Edges
  • Nodes
  • Clusters
  • Graphs

Note: svg only.

Search the Graphviz codebase for "class"

cluster

Whether the subgraph is a cluster

type: bool, default: false

Subgraph clusters are rendered differently, e.g. dot renders a box around subgraph clusters, but doesn't draw a box around non-subgraph clusters.

Example:

digraph cats {
  subgraph cluster_big_cats {
    // This subgraph is a cluster, because the name begins with "cluster"
    
    "Lion";
    "Snow Leopard";
  }

  subgraph domestic_cats {
    // This subgraph is also a cluster, because cluster=true.
    cluster=true;

    "Siamese";
    "Persian";
  }

  subgraph not_a_cluster {
    // This subgraph is not a cluster, because it doesn't start with "cluster",
    // nor sets cluster=true.
    
    "Wildcat";
  }
}
Valid on:
  • Clusters
  • Subgraphs

Search the Graphviz codebase for "cluster"

clusterrank

Mode used for handling clusters

type: clusterMode, default: local

If clusterrank=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.

The modes clusterrank=global and clusterrank=none appear to be identical, both turning off the special cluster processing.

Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "clusterrank"

color

Basic drawing color for graphics, not text

type: color | colorList, default: black

For the latter, use the fontcolor attribute.

For edges, the value can either be a single color or a colorList.

In the latter case, if colorList has no fractions, the edge is drawn using parallel splines or lines, one for each color in the list, in the order given.

The head arrow, if any, is drawn using the first color in the list, and the tail arrow, if any, the second color. This supports the common case of drawing opposing edges, but using parallel splines instead of separately routed multiedges.

If any fraction is used, the colors are drawn in series, with each color being given roughly its specified fraction of the edge.

For example, the graph:

Edge Color Example
digraph G {
  a -> b [dir=both color="red:blue"]
  c -> d [dir=none color="green:red;0.25:blue"]
}

yields:

Subgraph & Node Color Example
digraph G {
  subgraph cluster_yellow {
    color="yellow"
    a [color="red"]
    b [color="green"]
  }
}

yields:

See also:

Valid on:
  • Edges
  • Nodes
  • Clusters

Search the Graphviz codebase for "color"

colorscheme

A color scheme namespace: the context for interpreting color names

type: string, default: ""

In particular, if a color value has form "xxx" or "//xxx", then the color xxx will be evaluated according to the current color scheme. If no color scheme is set, the standard X11 naming is used.

For example, if colorscheme=oranges9 (from Brewer color schemes), then color=7 is interpreted as color="/oranges9/7", the 7th color in the oranges9 colorscheme.

Orange Colorscheme
graph {
  node [colorscheme=oranges9] # Apply colorscheme to all nodes
  1 [color=1]
  2 [color=2]
  3 [color=3]
  4 [color=4]
  5 [color=5]
  6 [color=6]
  7 [color=7]
  8 [color=8]
  9 [color=9]
}
Green Colorscheme
graph {
  node [colorscheme=greens9] # Apply colorscheme to all nodes
  1 [color=1]
  2 [color=2]
  3 [color=3]
  4 [color=4]
  5 [color=5]
  6 [color=6]
  7 [color=7]
  8 [color=8]
  9 [color=9]
}

See also:

Valid on:
  • Edges
  • Nodes
  • Clusters
  • Graphs

Search the Graphviz codebase for "colorscheme"

comment

Comments are inserted into output

type: string, default: ""

Device-dependent.

Example
digraph {
  comment="I am a graph"
  A [comment="I am node A"]
  B [comment="I am node B"]
  A->B [comment="I am an edge"]
}

Outputs SVG with comments:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.47.1 (20210417.1919)
 -->
<!-- This is a graph -->
<!-- Pages: 1 -->
<svg width="62pt" height="116pt"
 viewBox="0.00 0.00 62.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 112)">
<polygon fill="white" stroke="transparent" points="-4,4 -4,-112 58,-112 58,4 -4,4"/>
<!-- A -->
<!-- I am node A -->
<g id="node1" class="node">
<title>A</title>
<ellipse fill="none" stroke="black" cx="27" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-86.3" font-family="Times,serif" font-size="14.00">A</text>
</g>
<!-- B -->
<!-- I am node B -->
<g id="node2" class="node">
<title>B</title>
<ellipse fill="none" stroke="black" cx="27" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-14.3" font-family="Times,serif" font-size="14.00">B</text>
</g>
<!-- A&#45;&gt;B -->
<!-- I am an edge -->
<g id="edge1" class="edge">
<title>A&#45;&gt;B</title>
<path fill="none" stroke="black" d="M27,-71.7C27,-63.98 27,-54.71 27,-46.11"/>
<polygon fill="black" stroke="black" points="30.5,-46.1 27,-36.1 23.5,-46.1 30.5,-46.1"/>
</g>
</g>
</svg>
Valid on:
  • Edges
  • Nodes
  • Graphs

Search the Graphviz codebase for "comment"

compound

If true, allow edges between clusters

type: bool, default: false

See lhead and ltail.

digraph {
  compound=true;

  subgraph cluster_a {
    label="Cluster A";
    node1; node3; node5; node7;
  }
  subgraph cluster_b {
    label="Cluster B";
    node2; node4; node6; node8;
  }

  node1 -> node2 [label="1"];
  node3 -> node4 [label="2" ltail="cluster_a"];
  
  node5 -> node6 [label="3" lhead="cluster_b"];
  node7 -> node8 [label="4" ltail="cluster_a" lhead="cluster_b"];
}
Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "compound"

concentrate

If true, use edge concentrators

type: bool, default: false

This merges multiedges into a single edge and causes partially parallel edges to share part of their paths. The latter feature is not yet available outside of dot.

Example
digraph {
    concentrate=true
    a -> b [label="1"]
    c -> b
    d -> b
}
Valid on:
  • Graphs

Search the Graphviz codebase for "concentrate"

constraint

If false, the edge is not used in ranking the nodes

type: bool, default: true

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:

Valid on:
  • Edges

Note: dot only.

Search the Graphviz codebase for "constraint"

Damping

Factor damping force motions.

type: double, default: 0.99, minimum: 0.0

On each iteration, a node's movement is limited to this factor of its potential motion. By being less than 1.0, the system tends to "cool", thereby preventing cycling.

Valid on:
  • Graphs

Note: neato only.

Search the Graphviz codebase for "Damping"

decorate

Whether to connect the edge label to the edge with a line

type: bool, default: false

If true, attach edge label to edge by a 2-segment polyline, underlining the label, then going to the closest point of spline.

Example
digraph {
  a -> a [label="AA" decorate=true]
  a -> b [label="AB" decorate=true]
  b -> b [label="BB" decorate=false]
}
Valid on:
  • Edges

Search the Graphviz codebase for "decorate"

defaultdist

The distance between nodes in separate connected components

type: double, default: 1+(avg. len)*sqrt(|V|), minimum: epsilon

If set too small, connected components may overlap.

Only applicable if pack=false.

Valid on:
  • Graphs

Note: neato only.

Search the Graphviz codebase for "defaultdist"

dim

Set the number of dimensions used for the layout

type: int, default: 2, minimum: 2

The maximum value allowed is 10.

Valid on:
  • Graphs

Note: neato, fdp, sfdp only.

Search the Graphviz codebase for "dim"

dimen

Set the number of dimensions used for rendering

type: int, default: 2, minimum: 2

The maximum value allowed is 10.

If both dimen and dim are set, the latter specifies the dimension used for layout, and the former for rendering. If only dimen is set, this is used for both layout and rendering dimensions.

Note that, at present, all aspects of rendering are 2D. This includes the shape and size of nodes, overlap removal, and edge routing. Thus, for dimen > 2, the only valid information is the pos attribute of the nodes.

All other coordinates will be 2D and, at best, will reflect a projection of a higher-dimensional point onto the plane.

Valid on:
  • Graphs

Note: neato, fdp, sfdp only.

Search the Graphviz codebase for "dimen"

dir

Edge type for drawing arrowheads

type: dirType, default: forward (directed) , none (undirected)

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.

Example
digraph {
  A->B [dir=forward]
  C->D [dir=back]
  E->F [dir=both]
  G->H [dir=none]
}
Valid on:
  • Edges

Search the Graphviz codebase for "dir"

diredgeconstraints

Whether to constrain most edges to point downwards

type: string | bool, default: false

If true, constraints are generated for each edge in the largest (heuristic) directed acyclic subgraph such that the edge must point downwards.

Only valid when mode="ipsep".

If hier, generates level constraints similar to those used with mode="hier". The main difference is that, in the latter case, only these constraints are involved, so a faster solver can be used.

Valid on:
  • Graphs

Note: neato only.

Search the Graphviz codebase for "diredgeconstraints"

distortion

Distortion factor for shape=polygon

type: double, default: 0.0, minimum: -100.0

Positive values cause top part to be larger than bottom; negative values do the opposite.

See also skew.

Example
graph {
  LargeBottom [shape=polygon sides=4 distortion=-.5]
  LargeTop    [shape=polygon sides=4 distortion=.5]
}
Valid on:
  • Nodes

Search the Graphviz codebase for "distortion"

dpi

Specifies the expected number of pixels per inch on a display device

type: double, default: 96.0, 0.0

For bitmap output, dpi guarantees that text rendering will be done more accurately, both in size and in placement.

For SVG output, dpi guarantees the dimensions in the output correspond to the correct number of points or inches.

Valid on:
  • Graphs

Note: bitmap output, svg only.

Search the Graphviz codebase for "dpi"

edgehref

Synonym for edgeURL

type: escString, default: ""

See also:

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "edgehref"

edgetarget

Browser window to use for the edgeURL link

type: escString, default: <none>

If the edge has a URL or edgeURL attribute, edgetarget determines which window of the browser is used for the URL attached to the non-label part of the edge.

Setting edgetarget=_graphviz will open a new window if it doesn't already exist, or reuse it if it does.

If undefined, the value of the target is used instead.

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "edgetarget"

edgetooltip

Tooltip annotation attached to the non-label part of an edge

type: escString, default: ""

Valid on:
  • Edges

Note: cmap, svg only.

Search the Graphviz codebase for "edgetooltip"

edgeURL

The link for the non-label parts of an edge

type: escString, default: ""

edgeURL overrides any URL defined for the edge.

Also, edgeURL is used near the head or tail node unless overridden by headURL or tailURL, respectively.

See limitation.

See also:

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "edgeURL"

epsilon

Terminating condition

type: double, default: .0001 * # nodes (mode == KK) , .0001 (mode == major) , .01 (mode == sgd)

If the length squared of all energy gradients are less than epsilon, the algorithm stops.

Valid on:
  • Graphs

Note: neato only.

Search the Graphviz codebase for "epsilon"

esep

Margin used around polygons for purposes of spline edge routing

type: addDouble | addPoint, default: +3

The interpretation is the same as given for sep. esep should normally be strictly less than sep.

Valid on:
  • Graphs

Note: neato, fdp, sfdp, osage, circo, twopi only.

Search the Graphviz codebase for "esep"

fillcolor

Color used to fill the background of a node or cluster

type: color | colorList, default: lightgrey (nodes) , black (clusters)

Assuming style=filled, or a filled arrowhead.

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.

If the value is a colorList, a gradient fill is used. By default, this is a linear fill; setting style=radial will cause a radial fill. At present, only two colors are used. If the second color (after a colon) is missing, the default color is used for it.

See also the gradientangle attribute for setting the gradient angle.

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.

Valid on:
  • Nodes
  • Edges
  • Clusters

Search the Graphviz codebase for "fillcolor"

fixedsize

Whether to use the specified width and height attributes to choose node size (rather than sizing to fit the node contents)

type: bool | string, default: false

If false, the size of a node is determined by smallest width and height needed to contain its label and image, if any, with a margin specified by the margin attribute.

The width and height must also be at least as large as the sizes specified by the width and height attributes, which specify the minimum values for these parameters.

If true, the node size is specified by the values of the width and height attributes only and is not expanded to contain the text label. There will be a warning if the label (with margin) cannot fit within these limits.

If the fixedsize attribute is set to shape, the width and height attributes also determine the size of the node shape, but the label can be much larger. Both the label and shape sizes are used when avoiding node overlap, but all edges to the node ignore the label and only contact the node shape. No warning is given if the label is too large.

Valid on:
  • Nodes

Search the Graphviz codebase for "fixedsize"

fontcolor

Color used for text

type: color, default: black

Valid on:
  • Edges
  • Nodes
  • Graphs
  • Clusters

Search the Graphviz codebase for "fontcolor"

fontname

Font used for text

type: string, default: "Times-Roman"

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.

How font names are resolved also depends on the underlying library that handles font name resolution. If Graphviz was built using the fontconfig library, the latter library will be used to search for the font. See the commands fc-list, fc-match and the other fontconfig commands for how names are resolved and which fonts are available. Other systems may provide their own font package, such as Quartz for OS X.

Note that various font attributes, such as weight and slant, can be built into the font name. Unfortunately, the syntax varies depending on which font system is dominant. Thus, using fontname="times bold italic" will produce a bold, slanted Times font using Pango, the usual main font library. Alternatively, fontname="times:italic" will produce a slanted Times font from fontconfig, while fontname="times-bold" will resolve to a bold Times using Quartz. You will need to ascertain which package is used by your Graphviz system and refer to the relevant documentation.

If Graphviz is not built with a high-level font library, fontname will be considered the name of a Type 1 or True Type font file. If you specify fontname=schlbk, the tool will look for a file named schlbk.ttf or schlbk.pfa or schlbk.pfb in one of the directories specified by the fontpath attribute. The lookup does support various aliases for the common fonts.

digraph {
    label="Comic Sans MS"
    fontname="Comic Sans MS"
    subgraph cluster_a {
      label="Courier New"
      fontname="Courier New"
      Arial [fontname="Arial"];
      Arial -> Arial [label="Impact" fontname="Impact"]
    }
}
Valid on:
  • Edges
  • Nodes
  • Graphs
  • Clusters

Search the Graphviz codebase for "fontname"

fontnames

Allows user control of how basic fontnames are represented in SVG output

type: string, default: ""

If fontnames is undefined or svg, the output will try to use known SVG fontnames.

For example, the default font Times-Roman will be mapped to the basic SVG font serif. This can be overridden by setting fontnames to ps or hd. In the former case, known PostScript font names such as Times-Roman will be used in the output. In the latter case, the fontconfig font conventions are used. Thus, Times-Roman would be treated as Nimbus Roman No9 L. These last two options are useful with SVG viewers that support these richer fontname spaces.

Valid on:
  • Graphs

Note: svg only.

Search the Graphviz codebase for "fontnames"

fontpath

Directory list used by libgd to search for bitmap fonts

type: string, default: <system-dependent>

Used if Graphviz was not built with the fontconfig library.

If fontpath is not set, the environment variable DOTFONTPATH is checked.

If DOTFONTPATH is not set, GDFONTPATH is checked.

If GDFONTPATH not set, libgd uses its compiled-in font path.

Note that fontpath is an attribute of the root graph.

Valid on:
  • Graphs

Search the Graphviz codebase for "fontpath"

fontsize

Font size, in points, used for text

type: double, default: 14.0, minimum: 1.0

digraph {
    label="40pt Graph Label"
    fontsize="40"
    subgraph cluster_a {
      label="30pt Cluster Label"
      fontsize="30pt"
      "20pt Node" [fontsize="20pt"];
      "20pt Node"-> "20pt Node" [label="10pt Edge" fontsize="10"]
    }
}
Valid on:
  • Edges
  • Nodes
  • Graphs
  • Clusters

Search the Graphviz codebase for "fontsize"

forcelabels

Whether to force placement of all xlabels, even if overlapping

type: bool, default: true

If true, all xlabel attributes are placed, even if there is some overlap with nodes or other labels.

Valid on:
  • Graphs

Search the Graphviz codebase for "forcelabels"

gradientangle

If a gradient fill is being used, this determines the angle of the fill

type: int, default: 0, minimum: 0

For linear fills, the colors transform along a line specified by the angle and the center of the object. For radial fills, a value of zero causes the colors to transform radially from the center; for non-zero values, the colors transform from a point near the object's periphery as specified by the value.

If unset, the default angle is 0.

Valid on:
  • Nodes
  • Clusters
  • Graphs

Search the Graphviz codebase for "gradientangle"

group

Name for a group of nodes, for bundling edges avoiding crossings.

type: string, default: ""

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.

Valid on:
  • Nodes

Note: dot only.

Search the Graphviz codebase for "group"

head_lp

Center position of an edge's head label

type: point

In points.

Valid on:
  • Edges

Note: write only.

Search the Graphviz codebase for "head_lp"

headclip

If true, the head of an edge is clipped to the boundary of the head node

type: bool, default: true

Otherwise, the end of the edge goes to the center of the node, or the center of a port, if applicable.

Valid on:
  • Edges

Search the Graphviz codebase for "headclip"

headhref

Synonym for headURL

type: escString, default: ""

See also:

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "headhref"

headlabel

Text label to be placed near head of edge

type: lblString, default: ""

See limitation.

Valid on:
  • Edges

Search the Graphviz codebase for "headlabel"

headport

Indicates where on the head node to attach the head of the edge

type: portPos, default: center

In the default case, the edge is aimed towards the center of the node, and then clipped at the node boundary.

See limitation.

Valid on:
  • Edges

Search the Graphviz codebase for "headport"

headtarget

Browser window to use for the headURL link

type: escString, default: <none>

If the edge has a headURL, headtarget determines which window of the browser is used for the URL. Setting headURL=_graphviz will open a new window if the window doesn't already exist, or reuse the window if it does.

If undefined, the value of the target is used.

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "headtarget"

headtooltip

Tooltip annotation attached to the head of an edge

type: escString, default: ""

Used only if the edge has a headURL attribute.

See also:

Valid on:
  • Edges

Note: cmap, svg only.

Search the Graphviz codebase for "headtooltip"

headURL

If defined, headURL is output as part of the head label of the edge

type: escString, default: ""

Also, this value is used near the head node, overriding any URL value.

See limitation.

See also:

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "headURL"

height

Height of node, in inches

type: double, default: 0.5, minimum: 0.02

This is taken as the initial, minimum height of the node. If fixedsize is true, this will be the final height of the node. Otherwise, if the node label requires more height to fit, the node's height will be increased to contain the label.

If the output format is dot, the value given to height will be the final value.

If the node shape is regular, the width and height are made identical:

  • If both the width and the height are set explicitly, the maximum of the two values is used.
  • If one of width or height is set explicitly, that value is used for both width and height.
  • If neither is set explicitly, the minimum of the two default values is used.
Height Example
digraph G {
  "default"
  "1in" [height=1]
  "2in" [height=2]
}

See also:

Valid on:
  • Nodes

Search the Graphviz codebase for "height"

href

Synonym for URL

type: escString, default: ""

See also:

Valid on:
  • Graphs
  • Clusters
  • Nodes
  • Edges

Note: map, postscript, svg only.

Search the Graphviz codebase for "href"

id

Identifier for graph objects

type: escString, default: ""

Allows the graph author to provide an identifier for graph objects which is to be included in the output.

Normal \N, \E, \G substitutions are applied.

If provided, it is the responsibility of the provider to keep id values unique for its intended downstream use.

Note, in particular, that \E does not provide a unique id for multi-edges.

If no id attribute is provided, then a unique internal id is used. However, this value is unpredictable by the graph writer.

If the graph provides an id attribute, this will be used as a prefix for internally generated attributes. By making internally-used attributes distinct, the user can include multiple image maps in the same document.

Valid on:
  • Graphs
  • Clusters
  • Nodes
  • Edges

Note: map, postscript, svg only.

Search the Graphviz codebase for "id"

image

Gives the name of a file containing an image to be displayed inside a node

type: string, default: ""

The image file must be in one of the recognized formats, typically JPEG, PNG, GIF, BMP, SVG, or Postscript, and be able to be converted into the desired output format.

The file must contain the image size information:

  • Bitmap formats usually already contain image size.
  • PostScript files must contain a line starting with %%BoundingBox: followed by four integers specifying the lower left x and y coordinates and the upper right x and y coordinates of the bounding box for the image, the coordinates being in points.
  • An SVG image file must contain width and height attributes, typically as part of the svg element. The values for these should have the form of a floating point number, followed by optional units, e.g., width="76pt". Recognized units are in, px, pc, pt, cm and mm for inches, pixels, picas, points, centimeters and millimeters, respectively. The default unit is points.

Unlike with the shapefile attribute, the image is treated as node content rather than the entire node. In particular, an image can be contained in a node of any shape, not just a rectangle.

Only paths to local resources are supported. If you want to use a URL to a remote resource, see the dot_url_resolve.py script.

Valid on:
  • Nodes

Search the Graphviz codebase for "image"

imagepath

A list of directories in which to look for image files

type: string, default: ""

When specified by the image attribute or using the IMG element in HTML-like labels.

imagepath should be a list of (absolute or relative) pathnames, each separated by a semicolon ; (for Windows) or a colon : (all other OS).

The first directory in which a file of the given name is found will be used to load the image.

If imagepath is not set, relative pathnames for the image file will be interpreted with respect to the current working directory.

Valid on:
  • Graphs

Search the Graphviz codebase for "imagepath"

imagepos

Controls how an image is positioned within its containing node

type: string, default: "mc"

imagepos only has an effect when the image is smaller than the containing node.

The default is to be centered both horizontally and vertically.

Valid values:

  • tl - Top Left
  • tc - Top Centered
  • tr - Top Right
  • ml - Middle Left
  • mc - Middle Centered (the default)
  • mr - Middle Right
  • bl - Bottom Left
  • bc - Bottom Centered
  • br - Bottom Right
Valid on:
  • Nodes

Search the Graphviz codebase for "imagepos"

imagescale

Controls how an image fills its containing node

type: bool | string, default: false

In general, the image is given its natural size, (cf. dpi), and the node size is made large enough to contain its image, its label, its margin, and its peripheries.

Its width and height will also be at least as large as its minimum width and height. If, however, fixedsize=true, the width and height attributes specify the exact size of the node.

  • During rendering, in the default case (imagescale=false), the image retains its natural size.
  • If imagescale=true, the image is uniformly scaled (i.e., its aspect ratio is preserved) to fit inside the node. At least one dimension of the image will be as large as possible given the size of the node.
  • When imagescale=width, the width of the image is scaled to fill the node width.
  • The corresponding property holds when imagescale=height.
  • When imagescale=both, both the height and the width are scaled separately to fill the node.

In all cases, if a dimension of the image is larger than the corresponding dimension of the node, that dimension of the image is scaled down to fit the node.

As with the case of expansion, if imagescale=true, width and height are scaled uniformly.

Valid on:
  • Nodes

Search the Graphviz codebase for "imagescale"

inputscale

Scales the input positions to convert between length units

type: double, default: <none>

For layout algorithms that support initial input positions (specified by the pos attribute), this attribute can be used to appropriately scale the values.

By default, fdp and neato interpret the x and y values of pos as being in inches. (NOTE: neato -n(2) treats the coordinates as being in points, being the unit used by the layout algorithms for the pos attribute.) Thus, if the graph has pos attributes in points, one should set inputscale=72. This can also be set on the command line using the -s flag.

If unset, no scaling is done and the units on input are treated as inches.

inputscale=0 is equivalent to inputscale=72.

Valid on:
  • Graphs

Note: neato, fdp only.

Search the Graphviz codebase for "inputscale"

K

Spring constant used in virtual physical model

type: double, default: 0.3, minimum: 0

It roughly corresponds to an ideal edge length (in inches), in that increasing K tends to increase the distance between nodes.

Note that the edge attribute len can be used to override this value for adjacent nodes.

Valid on:
  • Graphs
  • Clusters

Note: fdp, sfdp only.

Search the Graphviz codebase for "K"

label

Text label attached to objects

type: lblString, default: "\N" (nodes) , "" (otherwise)

If a node's shape is record, then the label can have a special format which describes the record layout.

Note that a node's default label is "\N", so the node's name or ID becomes its label.

Technically, a node's name can be an HTML string but this will not mean that the node's label will be interpreted as an HTML-like label. This is because the node's actual label is an ordinary string, which will be replaced by the raw bytes stored in the node's name.

To get an HTML-like label, the label attribute value itself must be an HTML string.

Example: Van Gogh Paintings
graph {
  label="Vincent van Gogh Paintings"

  subgraph cluster_self_portraits {
    label="Self-portraits"

    spwgfh [label="Self-Portrait with Grey Felt Hat"]
    spaap [label="Self-Portrait as a Painter"]
  }
  
  subgraph cluster_flowers {
    label="Flowers"

    sf [label="Sunflowers"]
    ab [label="Almond Blossom"]
  }
}
Valid on:
  • Edges
  • Nodes
  • Graphs
  • Clusters

Search the Graphviz codebase for "label"

label_scheme

Whether to treat a node whose name has the form |edgelabel|* as a special node representing an edge label.

type: int, default: 0, minimum: 0

  • The default, label_scheme=0, produces no effect.
  • If label_scheme=1, sfdp uses a penalty-based method to make that kind of node close to the center of its neighbor.
  • With label_scheme=2, sfdp uses a penalty-based method to make that kind of node close to the old center of its neighbor.
  • Finally, label_scheme=3 invokes a two-step process of overlap removal and straightening.
Valid on:
  • Graphs

Note: sfdp only.

Search the Graphviz codebase for "label_scheme"

labelangle

The angle (in degrees) in polar coordinates of the head & tail edge labels.

type: double, default: -25.0, minimum: -180.0

Determines, along with labeldistance, where the headlabel / taillabel are placed with respect to the head / tail in polar coordinates.

The origin in the coordinate system is the point where the edge touches the node. The ray of 0 degrees goes from the origin back along the edge, parallel to the edge at the origin.

The angle, in degrees, specifies the rotation from the 0 degree ray, with positive angles moving counterclockwise and negative angles moving clockwise.

Valid on:
  • Edges

Search the Graphviz codebase for "labelangle"

labeldistance

Scaling factor for the distance of headlabel / taillabel from the head / tail nodes.

type: double, default: 1.0, minimum: 0.0

The default distance is 10 points.

labeldistance multiplies that default.

See labelangle for more details.

Valid on:
  • Edges

Search the Graphviz codebase for "labeldistance"

labelfloat

If true, allows edge labels to be less constrained in position

type: bool, default: false

In particular, it may appear on top of other edges.

Valid on:
  • Edges

Search the Graphviz codebase for "labelfloat"

labelfontcolor

Color used for headlabel and taillabel.

type: color, default: black

If not set, defaults to edge's fontcolor.

Valid on:
  • Edges

Search the Graphviz codebase for "labelfontcolor"

labelfontname

Font for headlabel and taillabel

type: string, default: "Times-Roman"

Font used for headlabel and taillabel.

If not set, defaults to edge's fontname.

Valid on:
  • Edges

Search the Graphviz codebase for "labelfontname"

labelfontsize

Font size of headlabel and taillabel

type: double, default: 14.0, minimum: 1.0

Font size, in points, used for headlabel and taillabel.

If not set, defaults to edge's fontsize.

Valid on:
  • Edges

Search the Graphviz codebase for "labelfontsize"

labelhref

Synonym for labelURL

type: escString, default: ""

See also:

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "labelhref"

labeljust

Justification for graph & cluster labels

type: string, default: "c"

  • If labeljust=r, the label is right-justified within bounding rectangle
  • If labeljust=l, left-justified
  • Else the label is centered.

Note that a subgraph inherits attributes from its parent. Thus, if the root graph sets labeljust=l, the subgraph inherits this value.

Graph label justifications
digraph {
  label="l"
  labeljust=l
  a
}
Graph label justifications
digraph {
  label="r"
  labeljust=r
  b
}
Cluster label justifications
digraph {
  subgraph cluster_l {
    label="l"
    labeljust=l
    a
  }
  subgraph cluster_c {
    label="c"
    labeljust=c
    b
  }
  subgraph cluster_r {
    label="r"
    labeljust=r
    c
  }
}
Valid on:
  • Graphs
  • Clusters

Search the Graphviz codebase for "labeljust"

labelloc

Vertical placement of labels for nodes, root graphs and clusters

type: string, default: "t" (clusters) , "b" (root graphs) , "c" (nodes)

For graphs and clusters, only labelloc=t and labelloc=b are allowed, corresponding to placement at the top and bottom, respectively.

By default, root graph labels go on the bottom and cluster labels go on the top.

Note that a subgraph inherits attributes from its parent. Thus, if the root graph sets labelloc=b, the subgraph inherits this value.

For nodes, this attribute is used only when the height of the node is larger than the height of its label.

If labelloc=t, labelloc=c, labelloc=b, the label is aligned with the top, centered, or aligned with the bottom of the node, respectively.

By default, the label is vertically centered.

Label at top of graph
digraph {
  labelloc="t"
  label="Title"
  a -> b
}
Label at bottom of graph
digraph {
  labelloc="b"
  label="Title"
  a -> b
}
Cluster Label Locations
digraph {
  label="Graph Title"
  subgraph cluster_t {
    labelloc="t"
    label="Cluster Top"
    a -> b
  }
  subgraph cluster_b {
    labelloc="b"
    label="Cluster Bottom"
    c -> d
  }
}
Node label positions
digraph {
  t [labelloc=t]
  c [labelloc=c]
  b [labelloc=b]
}
Valid on:
  • Nodes
  • Graphs
  • Clusters

Search the Graphviz codebase for "labelloc"

labeltarget

Browser window to open labelURL links in

type: escString, default: <none>

If the edge has a URL or labelURL attribute, this attribute determines which window of the browser is used for the URL attached to the label.

Setting labeltarget=_graphviz will open a new window if it doesn't already exist, or reuse it if it does.

If undefined, the value of the target is used.

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "labeltarget"

labeltooltip

Tooltip annotation attached to label of an edge

type: escString, default: ""

Valid on:
  • Edges

Note: cmap, svg only.

Search the Graphviz codebase for "labeltooltip"

labelURL

If defined, labelURL is the link used for the label of an edge

type: escString, default: ""

labelURL overrides any URL defined for the edge.

See also:

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "labelURL"

landscape

If true, the graph is rendered in landscape mode

type: bool, default: false

Synonymous with rotate=90 or orientation=landscape.

Rotations
digraph {
  landscape=true
  a -> b
}

See also:

Valid on:
  • Graphs

Search the Graphviz codebase for "landscape"

layer

Specifies layers in which the node, edge or cluster is present

type: layerRange, default: ""

Valid on:
  • Edges
  • Nodes
  • Clusters

Search the Graphviz codebase for "layer"

layerlistsep

The separator characters used to split attributes of type layerRange into a list of ranges.

type: string, default: ","

Valid on:
  • Graphs

Search the Graphviz codebase for "layerlistsep"

layers

A linearly ordered list of layer names attached to the graph

type: layerList, default: ""

The graph is then output in separate layers. Only those components belonging to the current output layer appear.

See How to use drawing layers (overlays).

Valid on:
  • Graphs

Search the Graphviz codebase for "layers"

layerselect

Selects a list of layers to be emitted

type: layerRange, default: ""

Valid on:
  • Graphs

Search the Graphviz codebase for "layerselect"

layersep

The separator characters for splitting the layers attribute into a list of layer names.

type: string, default: ":\t "

Valid on:
  • Graphs

Search the Graphviz codebase for "layersep"

layout

Which layout engine to use

type: string, default: ""

Specifies the name of the layout engine to use, such as dot or neato.

Normally, graphs should be kept independent of a type of layout. In some cases, however, it can be convenient to embed the type of layout desired within the graph.

For example, a graph containing position information from a layout might want to record what the associated layout engine was.

This attribute takes precedence over the -K flag or the actual command name used.

Valid on:
  • Graphs

Search the Graphviz codebase for "layout"

len

Preferred edge length, in inches

type: double, default: 1.0 (neato) , 0.3 (fdp)

See also:

Valid on:
  • Edges

Note: neato, fdp only.

Search the Graphviz codebase for "len"

levels

Number of levels allowed in the multilevel scheme

type: int, default: INT_MAX, minimum: 0.0

Valid on:
  • Graphs

Note: sfdp only.

Search the Graphviz codebase for "levels"

levelsgap

strictness of neato level constraints

type: double, default: 0.0

Specifies strictness of level constraints in neato when mode="ipsep" or mode=hier.

Larger positive values mean stricter constraints, which demand more separation between levels. On the other hand, negative values will relax the constraints by allowing some overlap between the levels.

Valid on:
  • Graphs

Note: neato only.

Search the Graphviz codebase for "levelsgap"

lhead

Logical head of an edge

type: string, default: ""

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.

digraph {
  compound=true;

  subgraph cluster_a {
    label="Cluster A";
    node1; node3; node5; node7;
  }
  subgraph cluster_b {
    label="Cluster B";
    node2; node4; node6; node8;
  }

  node1 -> node2 [label="1"];
  node3 -> node4 [label="2" ltail="cluster_a"];
  
  node5 -> node6 [label="3" lhead="cluster_b"];
  node7 -> node8 [label="4" ltail="cluster_a" lhead="cluster_b"];
}

See limitation.

Valid on:
  • Edges

Note: dot only.

Search the Graphviz codebase for "lhead"

lheight

Height of graph or cluster label, in inches

type: double

Valid on:
  • Graphs
  • Clusters

Note: write only.

Search the Graphviz codebase for "lheight"

linelength

How long strings should get before overflowing to next line, for text output.

type: int, default: 128, minimum: 60

Example, where an 80-character long string ("a " * 40) is broken up onto two lines, when printed as canonical output:

$ echo 'digraph G { linelength=60; N0 [label="a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a "]; }' | dot -Tcanon
digraph G {
        graph [linelength=60];
        node [label="\N"];
        N0      [label="a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
a a a a a a a a a a "];
}

The text overflows when the label reaches the given size.

Despite the linelength name, this is the length of the attribute string, not the length of the overall line (which includes the node ID and attribute key).

Valid on:
  • Graphs

Search the Graphviz codebase for "linelength"

lp

Label center position

type: point

Label center position, in points.

Valid on:
  • Edges
  • Graphs
  • Clusters

Note: write only.

Search the Graphviz codebase for "lp"

ltail

Logical tail of an edge

type: string, default: ""

When compound=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.

digraph {
  compound=true;

  subgraph cluster_a {
    label="Cluster A";
    node1; node3; node5; node7;
  }
  subgraph cluster_b {
    label="Cluster B";
    node2; node4; node6; node8;
  }

  node1 -> node2 [label="1"];
  node3 -> node4 [label="2" ltail="cluster_a"];
  
  node5 -> node6 [label="3" lhead="cluster_b"];
  node7 -> node8 [label="4" ltail="cluster_a" lhead="cluster_b"];
}

See limitation.

Valid on:
  • Edges

Note: dot only.

Search the Graphviz codebase for "ltail"

lwidth

Width of graph or cluster label, in inches

type: double

Valid on:
  • Graphs
  • Clusters

Note: write only.

Search the Graphviz codebase for "lwidth"

margin

For graphs, this sets x and y margins of canvas, in inches

type: double | point, default: <device-dependent>

If the margin is a single double, both margins are set equal to the given value.

Note that the margin is not part of the drawing but just empty space left around the drawing. The margin basically corresponds to a translation of drawing, as would be necessary to center a drawing on a page. Nothing is actually drawn in the margin. To actually extend the background of a drawing, see the pad attribute.

For clusters, margin specifies the space between the nodes in the cluster and the cluster bounding box. By default, this is 8 points.

For nodes, this attribute specifies space left around the node's label. By default, the value is 0.11,0.055.

Nodes Example: Tall Margins, Wide Margins, and Equal Margins
graph {
  "1.5x0.5" [shape=rect margin="1.5,0.5"] # in inches
  "0.5x1.5" [shape=rect margin="0.5,1.5"] # in inches
  "1.5x1.5" [shape=rect margin="1.5"]     # in inches
}
Example: Cluster and Graph Margins
graph {
    bgcolor=lightgray
    margin=0 # in inches
    
    subgraph cluster_one {
      margin=8 # in points
      a
      b
    }
    subgraph cluster_two {
      margin=16 # in points
      c
      d
    }
}
Valid on:
  • Nodes
  • Clusters
  • Graphs

Search the Graphviz codebase for "margin"

maxiter

Sets the number of iterations used

type: int, default: 100 * # nodes (mode == KK) , 200 (mode == major) , 30 (mode == sgd) , 600 (fdp)

Valid on:
  • Graphs

Note: neato, fdp only.

Search the Graphviz codebase for "maxiter"

mclimit

Scale factor for mincross (mc) edge crossing minimiser parameters

type: double, default: 1.0

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.

Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "mclimit"

mindist

Specifies the minimum separation between all nodes

type: double, default: 1.0, minimum: 0.0

Valid on:
  • Graphs

Note: circo only.

Search the Graphviz codebase for "mindist"

minlen

Minimum edge length (rank difference between head and tail)

type: int, default: 1, minimum: 0

See also:

Valid on:
  • Edges

Note: dot only.

Search the Graphviz codebase for "minlen"

mode

Technique for optimizing the layout

type: string, default: major

neato supports modes:

  • mode="major": neato uses stress majorization1.
  • mode="KK": neato uses the Kamada-Kawai2 version of the gradient descent method. KK is sometimes appreciably faster for small (number of nodes < 100) graphs. A significant disadvantage is that KK may cycle.
  • mode="sgd": neato uses a version of the Stochastic Gradient Descent3 method. sgd's advantage is faster and more reliable convergence than both the previous methods, while sgd's disadvantage is that it runs in a fixed number of iterations and may require larger values of maxiter in some graphs.

There are two experimental modes in neato:

  • mode="hier", which adds a top-down directionality similar to the layout used in dot, and
  • mode="ipsep", which allows the graph to specify minimum vertical and horizontal distances between nodes. (See the sep attribute.)

For sfdp, the default is mode="spring", which corresponds to using a spring-electrical model. Setting mode="maxent" causes a similar model to be run but one that also takes into account edge lengths specified by the len attribute.

Valid on:
  • Graphs

Note: neato only.

Search the Graphviz codebase for "mode"

model

Specifies how the distance matrix is computed for the input graph

type: string, default: shortpath

The distance matrix specifies the ideal distance between every pair of nodes. neato attemps to find a layout which best achieves these distances. By default, it uses the length of the shortest path, where the length of each edge is given by its len attribute.

  • If model="circuit", neato uses the circuit resistance model to compute the distances. This tends to emphasize clusters.
  • If model="subset", neato uses the subset model. This sets the edge length to be the number of nodes that are neighbors of exactly one of the end points, and then calculates the shortest paths. This helps to separate nodes with high degree.

For more control of distances, one can use model=mds. In this case, the len of an edge is used as the ideal distance between its vertices.

A shortest path calculation is only used for pairs of nodes not connected by an edge. Thus, by supplying a complete graph, the input can specify all of the relevant distances.

Valid on:
  • Graphs

Note: neato only.

Search the Graphviz codebase for "model"

newrank

Whether to use a single global ranking, ignoring clusters

type: bool, default: false

The original ranking algorithm in dot is recursive on clusters. This can produce fewer ranks and a more compact layout, but sometimes at the cost of a head node being place on a higher rank than the tail node. It also assumes that a node is not constrained in separate, incompatible subgraphs. For example, a node cannot be in a cluster and also be constrained by rank=same with a node not in the cluster.

This allows nodes to be subject to multiple constraints. Rank constraints will usually take precedence over edge constraints.

Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "newrank"

nodesep

In dot, nodesep specifies the minimum space between two adjacent nodes in the same rank, in inches

type: double, default: 0.25, minimum: 0.02

For other layouts, nodesep affects the spacing between loops on a single node, or multiedges between a pair of nodes.

Small node separation
digraph {
    nodesep=0.1;
    node1; node2; node3;
}
Large node separation
digraph {
    nodesep=0.5;
    node1; node2; node3;
}
Valid on:
  • Graphs

Search the Graphviz codebase for "nodesep"

nojustify

Whether to justify multiline text vs the previous text line (rather than the side of the container).

type: bool, default: false

By default, the justification of multi-line labels is done within the largest context that makes sense. Thus, in the label of a polygonal node, a left-justified line will align with the left side of the node (shifted by the prescribed margin). In record nodes, left-justified line will line up with the left side of the enclosing column of fields. If nojustify=true, multi-line labels will be justified in the context of itself.

For example, if nojustify is set, the first label line is long, and the second is shorter and left-justified, the second will align with the left-most character in the first line, regardless of how large the node might be.

See this example containing the \l (left-justify) escape-string:

Nojustify causes text to align with previous text line, not left side of box
digraph G {
  node [width=3 shape=box]
  a [nojustify=false label="The first line is longer\nnojustify=false\l"]
  b [nojustify=true label="The first line is longer\nnojustify=true\l"]
  a -> b
}
Nojustify causes text to align with previous text line, not record column
digraph G{
  c [nojustify=false shape=record label="{Records Example - Long Line\n | Title - Shorter Line\nnojustify=false\l}"]
  d [nojustify=true shape=record label="{Records Example - Long Line\n | Title - Shorter Line\nnojustify=true\l}"]
  c -> d
}
Valid on:
  • Graphs
  • Clusters
  • Nodes
  • Edges

Search the Graphviz codebase for "nojustify"

normalize

normalizes coordinates of final layout

type: double | bool, default: false

So that the first point is at the origin, and then rotates the layout so that the angle of the first edge is specified by the value of normalize in degrees.

If normalize is not a number, it is evaluated as a bool, with true corresponding to 0 degrees.

NOTE: Since the attribute is evaluated first as a number, 0 and 1 cannot be used for false and true.

Valid on:
  • Graphs

Note: neato, fdp, sfdp, twopi, circo only.

Search the Graphviz codebase for "normalize"

notranslate

Whether to avoid translating layout to the origin point

type: bool, default: false

By default, the final layout is translated so that the lower-left corner of the bounding box is at the origin.

This can be annoying if some nodes are pinned or if the user runs neato -n.

To avoid this translation, set notranslate=true.

Valid on:
  • Graphs

Note: neato only.

Search the Graphviz codebase for "notranslate"

nslimit

Sets number of iterations in network simplex applications

type: double

nslimit is used in computing node x coordinates.

If defined, # iterations = nslimit * # nodes; otherwise, # iterations = INT_MAX.

Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "nslimit"

nslimit1

Sets number of iterations in network simplex applications

type: double

nslimit1 is used for ranking nodes.

If defined, # iterations = nslimit * # nodes; otherwise, # iterations = INT_MAX.

Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "nslimit1"

oneblock

Whether to draw circo graphs around one circle.

type: bool, default: false

Observe two examples of rendering the same graph:

Example: Multiple Blocks
digraph G {
    layout="circo"
    oneblock=false

    N0 -> N1
    N1 -> N2
    N2 -> N3
    N3 -> N4
    N4 -> N0
    
    N4 -> N5
    N5 -> N6
    N6 -> N7
    N7 -> N8
    N8 -> N5
}
Example: One Block
digraph G {
    layout="circo"
    oneblock=true

    N0 -> N1
    N1 -> N2
    N2 -> N3
    N3 -> N4
    N4 -> N0
    
    N4 -> N5
    N5 -> N6
    N6 -> N7
    N7 -> N8
    N8 -> N5
}
Valid on:
  • Graphs

Note: circo only.

Search the Graphviz codebase for "oneblock"

ordering

Constrains the left-to-right ordering of node edges.

type: string, default: ""

If ordering="out", then the outedges of a node, that is, edges with the node as its tail node, must appear left-to-right in the same order in which they are defined in the input.

If ordering="in", then the inedges of a node must appear left-to-right in the same order in which they are defined in the input.

If defined as a graph or subgraph attribute, the value is applied to all nodes in the graph or subgraph.

Note that the graph attribute takes precedence over the node attribute.

Valid on:
  • Graphs
  • Nodes

Note: dot only.

Search the Graphviz codebase for "ordering"

orientation

node shape rotation angle, or graph orientation

type: double | string, default: 0.0, "", minimum: -360.0

When used on nodes: Angle, in degrees, to rotate polygon node shapes. For any number of polygon sides, 0 degrees rotation results in a flat base. When used on graphs: If "[lL]*", sets graph orientation to landscape.

Used only if rotate is not defined.

Node Orientations
digraph {
  layout=neato       # Render in a circular layout
  node [shape=house] # Make all nodes have 'house' shape

    0 [orientation=0]
   45 [orientation=45]
   90 [orientation=90]
  135 [orientation=135]
  180 [orientation=180]
  225 [orientation=225]
  270 [orientation=270]
  315 [orientation=315]
  0 -> 45 -> 90 -> 135 -> 180 -> 225 -> 270 -> 315 -> 0
}
Landscape Graph Orientation
digraph {
  orientation=L
  a -> b
}

See also:

Valid on:
  • Nodes
  • Graphs

Search the Graphviz codebase for "orientation"

outputorder

Specify order in which nodes and edges are drawn

type: outputMode, default: breadthfirst

Valid on:
  • Graphs

Search the Graphviz codebase for "outputorder"

overlap

Determines if and how node overlaps should be removed

type: string | bool, default: true

Nodes are first enlarged using the sep attribute. If true , overlaps are retained. If the value is "scale", overlaps are removed by uniformly scaling in x and y. If the value converts to "false", and it is available, Prism, a proximity graph-based algorithm, is used to remove node overlaps. This can also be invoked explicitly with overlap=prism. This technique starts with a small scaling up, controlled by the overlap_scaling attribute, which can remove a significant portion of the overlap. The prism option also accepts an optional non-negative integer suffix. This can be used to control the number of attempts made at overlap removal. By default, overlap="prism" is equivalent to overlap="prism1000". Setting overlap="prism0" causes only the scaling phase to be run.

If Prism is not available, or the version of Graphviz is earlier than 2.28, "overlap=false" uses a Voronoi-based technique. This can always be invoked explicitly with "overlap=voronoi".

If overlap="scalexy", x and y are separately scaled to remove overlaps.

If overlap="compress", the layout will be scaled down as much as possible without introducing any overlaps, obviously assuming there are none to begin with.

N.B. The remaining allowed values of overlap correspond to algorithms which, at present, can produce bad aspect ratios. In addition, we deprecate the use of the "ortho*" and "portho*".

If the value is "vpsc", overlap removal is done as a quadratic optimization to minimize node displacement while removing node overlaps.

If the value is "orthoxy" or "orthoyx", overlaps are moved by optimizing two constraint problems, one for the x axis and one for the y. The suffix indicates which axis is processed first. If the value is "ortho", the technique is similar to "orthoxy" except a heuristic is used to reduce the bias between the two passes. If the value is "ortho_yx", the technique is the same as "ortho", except the roles of x and y are reversed. The values "portho", "porthoxy", "porthoxy", and "portho_yx" are similar to the previous four, except only pseudo-orthogonal ordering is enforced.

If the layout is done by neato with mode="ipsep", then one can use overlap=ipsep. In this case, the overlap removal constraints are incorporated into the layout algorithm itself. N.B. At present, this only supports one level of clustering.

Except for fdp and sfdp, the layouts assume overlap="true" as the default. Fdp first uses a number of passes using a built-in, force-directed technique to try to remove overlaps. Thus, fdp accepts overlap with an integer prefix followed by a colon, specifying the number of tries. If there is no prefix, no initial tries will be performed. If there is nothing following a colon, none of the above methods will be attempted. By default, fdp uses overlap="9:prism". Note that overlap="true", overlap="0:true" and overlap="0:" all turn off all overlap removal.

By default, sfdp uses overlap="prism0".

Except for the Voronoi and prism methods, all of these transforms preserve the orthogonal ordering of the original layout. That is, if the x coordinates of two nodes are originally the same, they will remain the same, and if the x coordinate of one node is originally less than the x coordinate of another, this relation will still hold in the transformed layout. The similar properties hold for the y coordinates. This is not quite true for the "porth*" cases. For these, orthogonal ordering is only preserved among nodes related by an edge.

Valid on:
  • Graphs

Note: fdp, neato, sfdp, circo, twopi only.

Search the Graphviz codebase for "overlap"

overlap_scaling

Scale layout by factor, to reduce node overlap.

type: double, default: -4, minimum: -1e+10

When overlap=prism, the layout is scaled by this factor, thereby removing a fair amount of node overlap, and making node overlap removal faster and better able to retain the graph's shape.

  • If overlap_scaling is negative, the layout is scaled by -1*overlap_scaling times the average label size.

  • If overlap_scaling is positive, the layout is scaled by overlap_scaling.

  • If overlap_scaling is zero, no scaling is done.

Valid on:
  • Graphs

Note: prism, neato, sfdp, fdp, circo, twopi only.

Search the Graphviz codebase for "overlap_scaling"

overlap_shrink

Whether the overlap removal algorithm should perform a compression pass to reduce the size of the layout

type: bool, default: true

Valid on:
  • Graphs

Note: prism only.

Search the Graphviz codebase for "overlap_shrink"

pack

Whether each connected component of the graph should be laid out separately, and then the graphs packed together.

type: bool | int, default: false

If pack has an integral value, this is used as the size, in points,of a margin around each part; otherwise, a default margin of 8 is used.

If pack is interpreted as false, the entire graph is laid out together. The granularity and method of packing is influenced by the packmode attribute.

For layouts which always do packing, such as twopi, the pack attribute is just used to set the margin.

pack is treated as true if the value of pack is true (case-insensitive) or a non-negative integer.

Valid on:
  • Graphs

Search the Graphviz codebase for "pack"

packmode

How connected components should be packed

type: packMode, default: node

(cf packMode). Note that defining packmode will automatically turn on packing as though one had set pack=true.

Valid on:
  • Graphs

Search the Graphviz codebase for "packmode"

pad

Inches to extend the drawing area around the minimal area needed to draw the graph

type: double | point, default: 0.0555 (4 points)

If pad is a single double, both the x and y pad values are set equal to the given value. This area is part of the drawing and will be filled with the background color, if appropriate.

Normally, a small pad is used for aesthetic reasons, especially when a background color is used, to avoid having nodes and edges abutting the boundary of the drawn region.

Valid on:
  • Graphs

Search the Graphviz codebase for "pad"

page

Width and height of output pages, in inches

type: double | point

If only a single value is given, this is used for both the width and height.

If page 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.

At present, page only works for PostScript output. For other types of output, use another tool to split the output into multiple output files, or use viewport to generate multiple files.

Valid on:
  • Graphs

Search the Graphviz codebase for "page"

pagedir

The order in which pages are emitted

type: pagedir, default: BL

Used only if page is set and applicable.

Limited to one of the 8 row or column major orders.

Valid on:
  • Graphs

Search the Graphviz codebase for "pagedir"

pencolor

Color used to draw the bounding box around a cluster

type: color, default: black

If pencolor is not defined, color is used.

If color is not defined, bgcolor is used.

If bgcolor 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.

Valid on:
  • Clusters

Search the Graphviz codebase for "pencolor"

penwidth

Specifies the width of the pen, in points, used to draw lines and curves

type: double, default: 1.0, minimum: 0.0

including the boundaries of edges and clusters.

penwidth value is inherited by subclusters, and has no effect on text.

Previous to 31 January 2008, the effect of penwidth=W was achieved by including setlinewidth(W) as part of a style specification.

If both attributes are set, penwidth will be used.

Valid on:
  • Clusters
  • Nodes
  • Edges

Search the Graphviz codebase for "penwidth"

peripheries

Set number of peripheries used in polygonal shapes and cluster boundaries

type: int, default: <shape default> (nodes) , 1 (clusters) , minimum: 0

Note that user-defined shapes are treated as a form of box shape, so the default peripheries value is 1 and the user-defined shape will be drawn in a bounding rectangle. Setting peripheries=0 will turn this off.

peripheries=1 is the maximum value for clusters.

Valid on:
  • Nodes
  • Clusters

Search the Graphviz codebase for "peripheries"

pin

Keeps the node at the node's given input position

type: bool, default: false

If true and the node has a pos attribute on input, neato or fdp prevents the node from moving from the input position. This property can also be specified in the pos attribute itself (cf. the point type).

Note: Due to an artifact of the implementation, previous to 27 Feb 2014, final coordinates are translated to the origin. Thus, if you look at the output coordinates given in the (x)dot or plain format, pinned nodes will not have the same output coordinates as were given on input. If this is important, a simple workaround is to maintain the coordinates of a pinned node. The vector difference between the old and new coordinates will give the translation, which can then be subtracted from all of the appropriate coordinates.

After 27 Feb 2014, this translation can be avoided in neato by setting notranslate=true. However, if the graph specifies node overlap removal or a change in aspect ratio, node coordinates may still change.

Valid on:
  • Nodes

Note: neato, fdp only.

Search the Graphviz codebase for "pin"

pos

Position of node, or spline control points

type: point | splineType

For nodes, the position indicates the center of the node. On output, the coordinates are in points.

In neato and fdp, pos can be used to set the initial position of a node. By default, the coordinates are assumed to be in inches. However, the -s command line flag can be used to specify different units. As the output coordinates are in points, feeding the output of a graph laid out by a Graphviz program into neato or fdp will almost always require the -s flag.

When the -n command line flag is used with neato, it is assumed the positions have been set by one of the layout programs, and are therefore in points. Thus, neato -n can accept input correctly without requiring a -s flag and, in fact, ignores any such flag.

Valid on:
  • Edges
  • Nodes

Note: neato, fdp only.

Search the Graphviz codebase for "pos"

quadtree

Quadtree scheme to use

type: quadType | bool, default: normal

  • quadtree=true aliases quadtree=normal
  • quadtree=false aliases quadtree=none
  • quadtree=2 aliases quadtree=fast
Valid on:
  • Graphs

Note: sfdp only.

Search the Graphviz codebase for "quadtree"

quantum

If quantum > 0.0, node label dimensions will be rounded to integral multiples of the quantum

type: double, default: 0.0, minimum: 0.0

Valid on:
  • Graphs

Search the Graphviz codebase for "quantum"

rank

Rank constraints on the nodes in a subgraph

type: rankType

  • 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 with rank="source" or rank="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.)

For more information check this answer in Stack Overflow

Valid on:
  • Subgraphs

Note: dot only.

Search the Graphviz codebase for "rank"

rankdir

Sets direction of graph layout

type: rankdir, default: TB

For example, if rankdir="LR", and barring cycles, an edge T -> H; will go from left to right. By default, graphs are laid out from top to bottom.

This attribute also has a side-effect in determining how record nodes are interpreted. See record shapes.

Top to bottom (default)
digraph {
    rankdir="TB"
    a -> b -> c;
}
Bottom to top
digraph {
    rankdir="BT"
    a -> b -> c;
}
Left to right
digraph {
    rankdir="LR"
    a -> b -> c;
}
Right to left
digraph {
    rankdir="RL"
    a -> b -> c;
}
Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "rankdir"

ranksep

Specifies separation between ranks

type: double | doubleList, default: 0.5 (dot) , 1.0 (twopi) , minimum: 0.02

In dot, sets the 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, this attribute specifies the radial separation of concentric circles. For twopi, ranksep can also be a list of doubles. The first double specifies the radius of the inner circle; the second double specifies the increase in radius from the first circle to the second; etc. If there are more circles than numbers, the last number is used as the increment for the remainder.

Valid on:
  • Graphs

Note: dot, twopi only.

Search the Graphviz codebase for "ranksep"

ratio

Sets the aspect ratio (drawing height/drawing width) for the drawing

type: double | string

Note that this is adjusted before the size attribute constraints are enforced.

In addition, the calculations usually ignore the node sizes, so the final drawing size may only approximate what is desired.

If ratio is numeric, ratio 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 both size values exceed the width and height of the drawing, then both coordinate values of each node are scaled up accordingly. However, if either size dimension is smaller than the corresponding dimension in the drawing, one dimension is scaled up so that the final drawing has the same aspect ratio as specified by size. Then, when rendered, the layout will be scaled down uniformly in both dimensions to fit the given size, which may cause nodes and text to shrink as well. This may not be what the user wants, but it avoids the hard problem of how to reposition the nodes in an acceptable fashion to reduce the drawing 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="expand", the size attribute is set, and both the width and the height of the graph are less than the value in size, node positions are scaled uniformly until at least one dimension fits size exactly. Note that this is distinct from using size as the desired size, as here the drawing is expanded before edges are generated and all node and text sizes remain unchanged.

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.

Valid on:
  • Graphs

Search the Graphviz codebase for "ratio"

rects

Rectangles for fields of records, in points

type: rect

Valid on:
  • Nodes

Note: write only.

Search the Graphviz codebase for "rects"

regular

If true, force polygon to be regular.

type: bool, default: false

If true, the vertices of the polygon will lie on a circle whose center is the center of the node.

digraph {
    "pentagon1" [shape="pentagon"];
    "pentagon2" [shape="pentagon" regular=true]
    "hexagon1" [shape="hexagon"];
    "hexagon2" [shape="hexagon" regular=true];
}
Valid on:
  • Nodes

Search the Graphviz codebase for "regular"

remincross

If there are multiple clusters, whether to run edge crossing minimization a second time.

type: bool, default: true

Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "remincross"

repulsiveforce

The power of the repulsive force used in an extended Fruchterman-Reingold

type: double, default: 1.0, minimum: 0.0

force directed model. Values larger than 1 tend to reduce the warping effect at the expense of less clustering.

Valid on:
  • Graphs

Note: sfdp only.

Search the Graphviz codebase for "repulsiveforce"

resolution

Synonym for dpi.

type: double, default: 96.0, 0.0

Valid on:
  • Graphs

Note: bitmap output, svg only.

Search the Graphviz codebase for "resolution"

root

Specifies nodes to be used as the center of the layout

type: string | bool, default: <none> (graphs) , false (nodes)

The center of the layout will be the root of the generated spanning tree.

  • As a graph attribute, this gives the name of the node.
  • As a node attribute, it specifies that the node should be used as a central node.

In twopi, root will actually be the central node. In circo, the block containing the node will be central in the drawing of its connected component. If not defined, twopi will pick a most central node, and circo will pick a random node.

If the root attribute is defined as the empty string, twopi will reset it to name of the node picked as the root node.

For twopi, it is possible to have multiple roots, presumably one for each component. If more than one node in a component is marked as the root, twopi will pick one.

Valid on:
  • Graphs
  • Nodes

Note: twopi, circo only.

Search the Graphviz codebase for "root"

rotate

If rotate=90, sets drawing orientation to landscape

type: int, default: 0

Rotations
digraph {
  rotate=90
  a -> b
}

See also:

Valid on:
  • Graphs

Search the Graphviz codebase for "rotate"

rotation

Rotates the final layout counter-clockwise by the specified number of degrees

type: double, default: 0

Valid on:
  • Graphs

Note: sfdp only.

Search the Graphviz codebase for "rotation"

samehead

Edges with the same head and the same samehead value are aimed at the same point on the head

type: string, default: ""

This has no effect on loops.

Prior to Graphviz 8.0.1, each node can have at most 5 unique samehead values.

See limitation.

See also sametail.

Valid on:
  • Edges

Note: dot only.

Search the Graphviz codebase for "samehead"

sametail

Edges with the same tail and the same sametail value are aimed at the same point on the tail.

type: string, default: ""

This has no effect on loops.

Prior to Graphviz 8.0.1, each node can have at most 5 unique sametail values.

See limitation.

See also samehead.

Valid on:
  • Edges

Note: dot only.

Search the Graphviz codebase for "sametail"

samplepoints

Gives the number of points used for a circle/ellipse node

type: int, default: 8 (output) , 20 (overlap and image maps)

Used if the input graph defines the vertices attribute, and output is dot or xdot.

It plays the same role in neato, when adjusting the layout to avoid overlapping nodes, and in image maps.

Valid on:
  • Nodes

Search the Graphviz codebase for "samplepoints"

scale

Scales layout by the given factor after the initial layout

type: double | point

If only a single number is given, that number scales both width and height.

Valid on:
  • Graphs

Note: neato, twopi only.

Search the Graphviz codebase for "scale"

searchsize

During network simplex, the maximum number of edges with negative cut values to search when looking for an edge with minimum cut value.

type: int, default: 30

Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "searchsize"

sep

Margin to leave around nodes when removing node overlap

type: addDouble | addPoint, default: +4

This guarantees a minimal non-zero distance between nodes.

If the attribute begins with a plus sign '+', an additive margin is specified. That is, "+w,h" causes the node's bounding box to be increased by w points on the left and right sides, and by h points on the top and bottom.

Without a plus sign, the node is scaled by 1 + w in the x coordinate and 1 + h in the y coordinate.

If only a single number is given, this is used for both dimensions.

If unset but esep is defined, the sep values will be set to the esep values divided by 0.8. If esep is unset, the default value is used.

Example: No separation
graph {
    layout="fdp"
    sep="0"
    A -- B
    B -- C
    C -- D
    D -- A
}
Example: separation of 3
graph {
    layout="fdp"
    sep="3"
    A -- B
    B -- C
    C -- D
    D -- A
}
Valid on:
  • Graphs

Note: fdp, neato, sfdp, osage, circo, twopi only.

Search the Graphviz codebase for "sep"

shape

Sets the shape of a node

type: shape, default: ellipse

digraph {
    "pentagon" [shape="pentagon"];
    "hexagon" [shape="hexagon"];
}
Valid on:
  • Nodes

Search the Graphviz codebase for "shape"

shapefile

A file containing user-supplied node content

type: string, default: ""

(Deprecated).

Sets the node's shape="box". The image in the shapefile must be rectangular. The image formats supported as well as the precise semantics of how the file is used depends on the output format. For further details, see Image Formats and External PostScript files.

There is one exception to this usage: If shape="epsf", shapefile gives a filename containing a definition of the node in PostScript. The graphics defined must be contain all of the node content, including any desired boundaries. For further details, see External PostScript files.

Only paths to local resources are supported. If you want to use a URL to a remote resource, see the dot_url_resolve.py script.

Valid on:
  • Nodes

Search the Graphviz codebase for "shapefile"

showboxes

Print guide boxes for debugging

type: int, default: 0, minimum: 0

Print guide boxes in PostScript at the beginning of routesplines if showboxes=1, or at the end if showboxes=2. (Debugging, TB mode only!)

Valid on:
  • Edges
  • Nodes
  • Graphs

Note: dot only.

Search the Graphviz codebase for "showboxes"

sides

Number of sides when shape=polygon

type: int, default: 4, minimum: 0

Example: Polygons with 3-6 sides
graph {
  Triangle  [shape=polygon sides=3]
  Rectangle [shape=polygon sides=4]
  Pentagon  [shape=polygon sides=5]
  Hexagon   [shape=polygon sides=6]
}
Valid on:
  • Nodes

Search the Graphviz codebase for "sides"

size

Maximum width and height of drawing, in inches

type: double | point

If only a single number is given, this is used for both the width and the height.

If defined and the drawing is larger than the given size, the drawing is uniformly scaled down so that it fits within the given size.

If size ends in an exclamation point "!", then size is taken to be the desired minimum size. In this case, if both dimensions of the drawing are less than size, the drawing is scaled up uniformly until at least one dimension equals its dimension in size.

There is some interaction between the size and ratio attributes.

Valid on:
  • Graphs

Search the Graphviz codebase for "size"

skew

Skew factor for shape=polygon

type: double, default: 0.0, minimum: -100.0

Positive values skew top of polygon to right; negative to left.

See also distortion.

Example
graph {
  SkewLeft  [shape=polygon sides=4 skew=-.5]
  SkewRight [shape=polygon sides=4 skew=.5]
}
Valid on:
  • Nodes

Search the Graphviz codebase for "skew"

smoothing

Specifies a post-processing step used to smooth out an uneven distribution of nodes.

type: smoothType, default: "none"

Valid on:
  • Graphs

Note: sfdp only.

Search the Graphviz codebase for "smoothing"

sortv

Sort order of graph components for ordering packmode packing.

type: int, default: 0, minimum: 0

If packmode indicates an array packing, sortv specifies an insertion order among the components, with smaller values inserted first.

Valid on:
  • Graphs
  • Clusters
  • Nodes

Search the Graphviz codebase for "sortv"

splines

Controls how, and if, edges are represented

type: bool | string

If splines=true, edges are drawn as splines routed around nodes; if splines=false, edges are drawn as line segments. If splines=none or splines="", no edges are drawn at all.

(1 March 2007) splines=line and splines=spline can be used as synonyms for splines=false and splines=true, respectively.

In addition, splines=polyline specifies that edges should be drawn as polylines.

(28 Sep 2010) splines=ortho specifies edges should be routed as polylines of axis-aligned segments. Currently, the routing does not handle ports or, in dot, edge labels.

(25 Sep 2012) splines=curved specifies edges should be drawn as curved arcs.

splines=none
splines=""
splines=line
splines=false
splines=polyline splines=curved
splines=ortho splines=spline
splines=true

By default, splines is unset. How this is interpreted depends on the layout engine. For dot, the default is to draw edges as splines. For all other layouts, the default is to draw edges as line segments.

Note that for these latter layouts, if splines="true", this requires non-overlapping nodes (cf. overlap). If fdp is used for layout and splines="compound", then the edges are drawn to avoid clusters as well as nodes.

Valid on:
  • Graphs

Search the Graphviz codebase for "splines"

start

Parameter used to determine the initial layout of nodes

type: startType, default: ""

If unset, the nodes are randomly placed in a unit square with the same seed is always used for the random number generator, so the initial placement is repeatable.

The following examples have the same graph, but render differently due to their start values:

Set random seed to 1
graph {
    layout="fdp"
    start=1
    A -- B; B -- C; C -- D; D -- A
}
Set random seed to 2, graph looks different
graph {
    layout="fdp"
    start=2
    A -- B; B -- C; C -- D; D -- A
}
Valid on:
  • Graphs

Note: neato, fdp, sfdp only.

Search the Graphviz codebase for "start"

style

Set style information for components of the graph

type: style, default: ""

For cluster subgraphs, if style="filled", the cluster box's background is filled.

If the default style attribute has been set for a component, an individual component can use style="" to revert to the normal default. For example, if the graph has

digraph {
  edge [style="invis"]
  a -> b
}

making all edges invisible, the b->c edge can overrride this via:

digraph {
  edge [style="invis"]
  a -> b
  b -> c [style=""]
}

Of course, the component can also explicitly set its style attribute to the desired value.

Valid on:
  • Edges
  • Nodes
  • Clusters
  • Graphs

Search the Graphviz codebase for "style"

stylesheet

A URL or pathname specifying an XML style sheet, used in SVG output

type: string, default: ""

Combine with class to style elements using CSS selectors.

See also:

Valid on:
  • Graphs

Note: svg only.

Search the Graphviz codebase for "stylesheet"

tail_lp

Position of an edge's tail label, in points.

type: point

The position indicates the center of the label.

Valid on:
  • Edges

Note: write only.

Search the Graphviz codebase for "tail_lp"

tailclip

If true, the tail of an edge is clipped to the boundary of the tail node

type: bool, default: true

otherwise, the end of the edge goes to the center of the node, or the center of a port, if applicable.

Valid on:
  • Edges

Search the Graphviz codebase for "tailclip"

tailhref

Synonym for tailURL.

type: escString, default: ""

See also:

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "tailhref"

taillabel

Text label to be placed near tail of edge

type: lblString, default: ""

See limitation.

Valid on:
  • Edges

Search the Graphviz codebase for "taillabel"

tailport

Indicates where on the tail node to attach the tail of the edge

type: portPos, default: center

See limitation.

Valid on:
  • Edges

Search the Graphviz codebase for "tailport"

tailtarget

Browser window to use for the tailURL link

type: escString, default: <none>

If the edge has a tailURL, tailtarget determines which window of the browser is used for the URL.

Setting tailtarget=_graphviz will open a new window if it doesn't already exist, or reuse it if it does.

If undefined, the value of the target is used.

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "tailtarget"

tailtooltip

Tooltip annotation attached to the tail of an edge

type: escString, default: ""

Used only if the edge has a tailURL attribute.

Valid on:
  • Edges

Note: cmap, svg only.

Search the Graphviz codebase for "tailtooltip"

tailURL

If defined, tailURL is output as part of the tail label of the edge

type: escString, default: ""

Also, this value is used near the tail node, overriding any URL value.

See limitation.

See also:

Valid on:
  • Edges

Note: map, svg only.

Search the Graphviz codebase for "tailURL"

target

If the object has a URL, this attribute determines which window of the browser is used for the URL.

type: escString | string, default: <none>

See W3C documentation.

Valid on:
  • Edges
  • Nodes
  • Graphs
  • Clusters

Note: map, svg only.

Search the Graphviz codebase for "target"

TBbalance

Which rank to move floating (loose) nodes to

type: string, default: ''

Valid options:

  • "min": Move floating (loose) nodes to minimum rank.
  • "max": Move floating (loose) nodes to maximum rank.
  • Otherwise, floating nodes are placed anywhere.

Despite the name TBbalance ("Top-Bottom Balance"), this also works with left-right ranks, e.g. rankdir=LR.

Examples:

Default Behaviour
digraph {
    layout="dot"

    { rank="min"; "min" }
    { rank="max"; "max" }
    "min" -> "middle" -> "max"
    
    "Floater 1"
    "Floater 2"
}
Floating nodes moved to min rank
digraph {
    layout="dot"
    TBbalance="min"

    { rank="min"; "min" }
    { rank="max"; "max" }
    "min" -> "middle" -> "max"
    
    "Floater 1"
    "Floater 2"
}
Floating nodes moved to max rank
digraph {
    layout="dot"
    TBbalance="max"

    { rank="min"; "min" }
    { rank="max"; "max" }
    "min" -> "middle" -> "max"
    
    "Floater 1"
    "Floater 2"
}
Valid on:
  • Graphs

Note: dot only.

Search the Graphviz codebase for "TBbalance"

tooltip

Tooltip (mouse hover text) attached to the node, edge, cluster, or graph

type: escString, default: ""

If tooltip is unset, Graphviz will use the object's label if defined.

Note that if the label is a record specification or an HTML-like label, the resulting tooltip may be unhelpful. In this case, if tooltips will be generated, the user should set a tooltip attribute explicitly.

Tooltips
digraph {
  label="Graph Label"
  tooltip="Graph Tooltip"
  subgraph cluster_a {
    label="Cluster Label"
    tooltip="Cluster Tooltip"
    Node1 [tooltip="Node1 Tooltip"]
    Node1 -> Node2 [label="Edge" tooltip="Edge Tooltip"]
  }
}

See also:

Valid on:
  • Nodes
  • Edges
  • Clusters
  • Graphs

Note: cmap, svg only.

Search the Graphviz codebase for "tooltip"

truecolor

Whether internal bitmap rendering relies on a truecolor color model or uses

type: bool

color palette.

If truecolor is unset, truecolor is not used unless there is a shapefile property for some node in the graph. The output model will use the input model when possible.

Use of color palettes results in less memory usage during creation of the bitmaps and smaller output files.

Usually, the only time it is necessary to specify the truecolor model is if the graph uses more than 256 colors. However, if one uses bgcolor=transparent with a color palette, font antialiasing can show up as a fuzzy white area around characters. Using truecolor=true avoids this problem.

Valid on:
  • Graphs

Note: bitmap output only.

Search the Graphviz codebase for "truecolor"

URL

Hyperlinks incorporated into device-dependent output

type: escString, default: <none>

At present, used in ps2, cmap, 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, cmap 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.

For svg, cmapx and imap output, the active area for a node is its visible image. For example, an unfilled node with no drawn boundary will only be active on its label. For other output, the active area is its bounding box. The active area for a cluster is its bounding box. For edges, the active areas are small circles where the edge contacts its head and tail nodes. In addition, for svg, cmapx and imap, the active area includes a thin polygon approximating the edge. The circles 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.

For edges, the attributes headURL, tailURL, labelURL and edgeURL allow control of various parts of an edge.

if active areas of two edges overlap, it is unspecified which area dominates.

See also:

Example: Van Gogh Paintings with Links
graph {
  label="Vincent van Gogh Paintings"
  URL="https://en.wikipedia.org/wiki/Vincent_van_Gogh"

  subgraph cluster_self_portraits {
    URL="https://en.wikipedia.org/wiki/Portraits_of_Vincent_van_Gogh"
    label="Self-portraits"

    "Self-Portrait with Grey Felt Hat" [URL="https://www.vangoghmuseum.nl/en/collection/s0016V1962"]
    "Self-Portrait as a Painter" [URL="https://www.vangoghmuseum.nl/en/collection/s0022V1962"]
  }
  
  subgraph cluster_flowers {
    URL="https://en.wikipedia.org/wiki/Sunflowers_(Van_Gogh_series)"
    label="Flowers"

    "Sunflowers" [URL="https://www.nationalgallery.org.uk/paintings/vincent-van-gogh-sunflowers"]
    "Almond Blossom" [URL="https://www.vangoghmuseum.nl/en/collection/s0176V1962"]
  }
}
Valid on:
  • Edges
  • Nodes
  • Graphs
  • Clusters

Note: map, postscript, svg only.

Search the Graphviz codebase for "URL"

vertices

Sets the coordinates of the vertices of the node's polygon, in inches

type: pointList

Used if the node is polygonal, and output is dot or xdot.

If the node is an ellipse or circle, the samplepoints attribute affects the output.

Valid on:
  • Nodes

Note: write only.

Search the Graphviz codebase for "vertices"

viewport

Clipping window on final drawing

type: viewPort, default: ""

viewport supersedes any size attribute. The width and height of the viewport specify precisely the final size of the output.

Valid on:
  • Graphs

Search the Graphviz codebase for "viewport"

voro_margin

Tuning margin of Voronoi technique

type: double, default: 0.05, minimum: 0.0

Factor to scale up drawing to allow margin for expansion in Voronoi technique. dim' = (1+2*margin)*dim.

Valid on:
  • Graphs

Note: neato, fdp, sfdp, twopi, circo only.

Search the Graphviz codebase for "voro_margin"

weight

Weight of edge

type: int | double, default: 1, minimum: 0(dot,twopi), 1(neato,fdp)

In dot, the heavier the weight, the shorter, straighter and more vertical the edge is.

For twopi, weight=0 indicates the edge should not be used in constructing a spanning tree from the root.

For other layouts, a larger weight encourages the layout to make the edge length closer to that specified by the len attribute.

Weights in dot must be integers.

Edge Weights
digraph {
  root -> a
  root -> b [weight=2]
  root -> c [weight=3]
}
Valid on:
  • Edges

Search the Graphviz codebase for "weight"

width

Width of node, in inches

type: double, default: 0.75, minimum: 0.01

This is taken as the initial, minimum width of the node. If fixedsize is true, this will be the final width of the node. Otherwise, if the node label requires more width to fit, the node's width will be increased to contain the label.

If the output format is dot, the value given to width will be the final value.

If the node shape is regular, the width and height are made identical:

  • If either the width or the height is set explicitly, that value is used.
  • If both the width or the height are set explicitly, the maximum of the two values is used.
  • If neither is set explicitly, the minimum of the two default values is used.
Width Example
digraph {
  "d" # default
  "1in" [width=1]
  "2in" [width=2]
}
Valid on:
  • Nodes

Search the Graphviz codebase for "width"

xdotversion

Determines the version of xdot used in output

type: string

Only used for xdot output.

If unset, graphviz will set this attribute to the xdot version used for output.

Valid on:
  • Graphs

Note: xdot only.

Search the Graphviz codebase for "xdotversion"

xlabel

External label for a node or edge

type: lblString, default: ""

  • For nodes, the label will be placed outside of the node but near it.
  • For edges, the label will be placed near the center of the edge. This can be useful in dot to avoid the occasional problem when the use of edge labels distorts the layout.
  • For other layouts, the xlabel attribute can be viewed as a synonym for the label attribute.

These labels are added after all nodes and edges have been placed.

The labels will be placed so that they do not overlap any node or label. This means it may not be possible to place all of them. To force placing all of them, set forcelabels=true.

External Labels on Nodes and Edges
digraph {
  "⚡" [xlabel="Sparks"]
  "🔥" [xlabel="Fires"]
  "⚡"->"🔥" [xlabel="Sometimes" label="Cause"]
}
Valid on:
  • Edges
  • Nodes

Search the Graphviz codebase for "xlabel"

xlp

Position of an exterior label, in points

type: point

The position indicates the center of the label.

Valid on:
  • Nodes
  • Edges

Note: write only.

Search the Graphviz codebase for "xlp"

z

Z-coordinate value for 3D layouts and displays

type: double, default: 0.0, minimum: -MAXFLOAT, -1000

Deprecated: Use pos attribute, along with dimen and/or dim to specify dimensions.

If the graph has dim set to 3 (or more), neato will use a node's z value for the z coordinate of its initial position if its pos attribute is also defined.

Even if no z values are specified in the input, it is necessary to declare a z attribute for nodes, e.g, using node[z=""] in order to get z values on output. Thus, setting dim=3 but not declaring z will cause neato -Tvrml to layout the graph in 3D but project the layout onto the xy-plane for the rendering. If the z attribute is declared, the final rendering will be in 3D.

Valid on:
  • Nodes

Search the Graphviz codebase for "z"

Last modified October 4, 2022: links in description of Attributes list (124be9d)