Introduction to Graphviz

The Graphviz package contains graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. Graphviz has several main graph layout programs. It also has web and interactive graphical interfaces, auxiliary tools, libraries, and language bindings.



Development versions of BLFS may not build or run some packages properly if dependencies have been updated since the most recent stable versions of the book.

Package Information

Graphviz Dependencies



Graphviz basic usage does not need any libraries out of what is found in the LFS book. Its core rendering engine allows to generate several graphic formats, such as Postscript, SVG, VML, .fig, and Tk. Those formats can be converted to almost any other format using for example tools from ImageMagick-7.1.0-46. The dependencies below add the ability to generate graph images in bitmap format, to display the graph image on screen, to edit a graph by viewing the resulting image directly, or to view large graphs. Since Graphviz is a dependency of several other packages in this book, it is suggested to first build it without any dependencies, then to rebuild it when you have built enough packages to suit your needs.

Optional, for various bitmap outputs

Pango-1.50.11, with Cairo-1.17.6, Xorg Libraries, Fontconfig-2.14.0, and libpng-1.6.38, to generate images in bitmap SVG, postscript, PNG, and PDF formats, or displaying the image on screen. The PNG output is required for building gegl-0.4.38

Adding GTK+-2.24.33 with libjpeg-turbo-2.1.4 adds support for JPEG, BMP, TIF, and ICO formats, and allows displaying the image in a GTK+ window

GD Library may be used instead of Pango. It adds the ability to generate images in GIF, VRML, and GD formats, but Pango provides better outputs for the other formats, and is needed for displaying images

Other formats may be added with libwebp-1.2.4 (WebP support is considered experimental), DevIL, libLASi, and glitz

Optional, to load graphic images that may be displayed inside the nodes of a graph from ghostscript-10.00.0, librsvg-2.54.5, and Poppler-22.10.0

Optional, to build more tools

Freeglut-3.2.2 (with libglade-2.6.4, GtkGLExt, and libGTS, for building the smyrna large graph viewer, which is considered experimental), and Qt-5.15.6 (for building the gvedit graph editor.)

Optional (To Build Language Bindings)

SWIG-4.0.2 (SWIG must be installed or no bindings will be built), GCC-12.2.0 (for the go compiler), Guile-3.0.8, OpenJDK-18.0.2, Lua-5.4.4, PHP-8.1.10, Ruby-3.1.2, Tk-8.6.12, Io, Mono, OCaml, and R

Optional (building tools)

Criterion (framework for tests) and Electric Fence

Optional (for building the pdf documentation)

ghostscript-10.00.0 (for the ps2pdf command)

User Notes:

Installation of Graphviz

Install Graphviz by running the following commands:

sed -i '/LIBPOSTFIX="64"/s/64//' &&

./              &&
./configure --prefix=/usr \
            --disable-php \


A warning is generated by because the build tree is not a git repository. As a result, the build date is set to 0. To get a meaningful date in the version string, you can run:

sed -i "s/0/$(date +%Y%m%d)/" builddate.h

Whether or not you fix the date, proceed to compile the package:


This package does not come with a test suite that provides meaningful results.

Now, as the root user:

make install

Command Explanations

sed ... This command is needed to avoid installing files in /usr/lib64.

--disable-php: This version of graphviz does not support php version 8.

--with-javaincludedir="$JAVA_HOME/include -I$JAVA_HOME/include/linux": If you have built OpenJDK-18.0.2 in /opt, and you want to build the JAVA bindings, it is necessary to specify the location of the JAVA header files to configure. The configure switch is designed for only one directory, but two directories need to be included. This is possible nevertheless by using the -I switch inside the variable.

--with-webp: Even if libwebp-1.2.4 is installed, it is not included in the build without this option.

--with-smyrna: Even if the needed dependencies are installed, the interactive graph viewer smyrna is not built without this option.

Configuring Graphviz

Config Files


Configuration Information

There are no specific configuration requirements for Graphviz. You may consider installing the additional plugins and tools available from the download page at for additional capabilities. If additional plugins are installed, you can run dot -c (as the root user) to update the config file in /usr/lib/graphviz.


Installed Programs: acyclic, bcomps, ccomps, circo, cluster, diffimg, dijkstra, dot, dot2gxl, dot_builtins, edgepaint, fdp, gc, gml2gv, graphml2gv, gv2gml, gv2gxl, gvcolor, gvedit, gvgen, gvmap,, gvpack, gvpr, gxl2dot, gxl2gv, mm2gv, neato, nop, osage, patchwork, prune, sccmap, sfdp, tred, twopi, unflatten, and vimdot
Installed Libraries:,,,,,,, and several plugins in /usr/lib/graphviz. There are also several in subdirectories of /usr/lib/{lua,perl5,python3.10,tcl8.6}. Unfortunately, some libraries are duplicated.
Installed Directories: /usr/include/graphviz, /usr/lib/graphviz, /usr/lib/tcl8.6/graphviz, /usr/share/doc/graphviz-6.0.1, and /usr/share/graphviz

Short Descriptions


is a filter that takes a directed graph as input and outputs a copy of the graph with sufficient edges reversed to make the graph acyclic


decomposes graphs into their biconnected components, printing the components to standard output


decomposes graphs into their connected components, printing the components to standard output


draws graphs using a circular layout


takes a graph in DOT format as input, finds node clusters and then augments the graph with this information


(needs GD Library) generates an image where each pixel is the difference between the corresponding pixel in each of the two source images


reads a stream of graphs and for each computes the distance of every node from sourcenode


draws directed graphs. It works well on DAGs and other graphs that can be drawn as hierarchies. It reads attributed graph files and writes drawings. By default, the output format dot is the input file with layout coordinates appended


converts between graphs represented in GXL and in the DOT language. Unless a conversion type is specified using a flag, gxl2dot will deduce the type of conversion from the suffix of the input file, a .dot suffix causing a conversion from DOT to GXL, and a .gxl suffix causing a conversion from GXL to DOT


performs edge coloring to disambiguate crossing edges


draws undirected graphs using a spring model. It relies on a force-directed approach in the spirit of Fruchterman and Reingold


is a graph analogue to wc in that it prints to standard output the number of nodes, edges, connected components or clusters contained in the input files. It also prints a total count for all graphs if more than one graph is given


converts a graph specified in the GML format to a graph in the GV (formerly DOT) format


converts a graph specified in the GRAPHML format to a graph in the GV (formerly DOT) format


converts a graph specified in the GV format to a graph in the GML format


converts a graph specified in the GV format to a graph in the GXL format


is a filter that sets node colors from initial seed values. Colors flow along edges from tail to head, and are averaged (as HSB vectors) at nodes


provides a simple graph editor and viewer. It allows many graphs to be viewed at the same time. The text of each graph is displayed in its own text window


generates a variety of simple, regularly-structured abstract graphs


takes as input a graph in DOT format, finds node clusters and produces a rendering of the graph as a geographic-style map, with clusters highlighted, in xdot format

is a pipeline for running gvmap


reads in a stream of graphs, combines the graphs into a single layout, and produces a single graph serving as the union of the input graphs


is a graph stream editor inspired by awk. It copies input graphs to its output, possibly transforming their structure and attributes, creating new graphs, or printing arbitrary information


converts between graphs represented in GXL and in the DOT language. Unless a conversion type is specified using a flag, gxl2dot will deduce the type of conversion from the suffix of the input file, a .dot suffix causing a conversion from DOT to GXL, and a .gxl suffix causing a conversion from GXL to DOT


converts between graphs represented in GXL and in the GV language


converts a sparse matrix of the Matrix Market format to a graph in the GV (formerly DOT) format


draws undirected graphs using spring models. Input files must be formatted in the dot attributed graph language. By default, the output of neato is the input graph with layout coordinates appended


reads a stream of graphs and prints each in pretty-printed (canonical) format on stdout. If no files are given, it reads from stdin


draws clustered graphs. It takes any graph in DOT format as input


draws clustered graphs using a squarified treemap layout. It takes any graph in DOT format as input


reads directed graphs in the same format used by dot and removes subgraphs rooted at nodes specified on the command line via options


decomposes digraphs into strongly connected components and an auxiliary map of the relationship between components. In this map, each component is collapsed into a node. The resulting graphs are printed to stdout


draws undirected graphs using the spring model, but it uses a multi-scale approach to produce layouts of large graphs in a reasonably short time


computes the transitive reduction of directed graphs, and prints the resulting graphs to standard output. This removes edges implied by transitivity. Nodes and subgraphs are not otherwise affected


draws graphs using a radial layout. Basically, one node is chosen as the center and put at the origin. The remaining nodes are placed on a sequence of concentric circles centered about the origin, each a fixed radial distance from the previous circle


is a preprocessor to dot that is used to improve the aspect ratio of graphs having many leaves or disconnected nodes. The usual layout for such a graph is generally very wide or tall


is a simple script which launches the gvim or vim editor along with a GUI window showing the dot output of the edited file

manages run-time dictionaries using standard container data types: unordered set/multiset, ordered set/multiset, list, stack, and queue

supports graph programming by maintaining graphs in memory and reading and writing graph files. Graphs are composed of nodes, edges, and nested subgraphs

provides a context for applications wishing to manipulate and render graphs. It provides command line parsing interfaces, common rendering code, and a plugin mechanism for renderers

contains functions to find the shortest path between two points in a simple polygon

provides support for parsing and deparsing graphical operations specified by the xdot language