Send Close Add comments: (status displays here)
Got it!  This site "robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.  Note: This appears on each machine/browser from which this site is accessed.
Graphviz: dot
by RS  admin@robinsnyder.com : 1024 x 640


1. Graphviz
Graphviz is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics, software engineering, database and web design, machine learning, and in visual interfaces for other technical domains. From the Graphviz web site at https://www.graphviz.org/. Note that one installs "Graphviz" but the command to use it (and check the installed version) is dot.

The default file extension of a Graphviz file is dot.

Graphviz should already be installed on CentOS but the command is dot. The following Linux command(s) install graphviz and dot.
sudo yum -y install graphviz

The following Linux command(s) display the installed version of dot.
dot -V

On 2019-08-14 the output was as follows.
dot - graphviz version 2.30.1 (20180420.1509)


2. Hello world
Here is a "Hello world" program in GraphViz. GraphViz hello worldHere is the GraphViz diagram. Here is the code that creates the diagram.


3. Command
Here is the command to run graphviz and create a png file using the above file. The input file is hello.dot.
dot -Tpng -ohello.png hello.dot

The output file is hello.png.

4. Dots per inch
The following command can be used to set the DPI (Dots Per Inch) of the image.
dot -Tpng -Gdip-300 -ohello.png hello.dot

Note: The following line could be added to the graph code, but it is often better (for automation) to set it from the command line.
graph [ dip = 300 ] ;

There are many other settings that can be used.

5. SVG
A raster image, such as a in the format PNG (Portable Network Graphics), pixelizes as the image is scaled.

A vector format such as SVG (Scalable Vector Graphics) does not have this effect.

Here is a GraphViz command to create a SVG file.
$dot -Tsvg -ohello.svg hello.dot


6. End of page

by RS  admin@robinsnyder.com : 1024 x 640