SVG using Graphviz

From PostgreSQL wiki

Jump to: navigation, search

Graphviz

Graphviz (https://graphviz.org/) is a package of tools which visualize directed and undirected graphs with different strategies:

  • dot - default for directed graphs
  • neato - "spring model" layouts
  • fdp - similar to neato
  • sfdp - multiscale version of fdp for the layout of large graphs
  • twopi - radial layouts
  • circo - circular layout

The syntax of source files is DOT (https://en.wikipedia.org/wiki/DOT_(graph_description_language) ), the default file extention is .gv.

Example

The typical header of our files looks like this:

digraph {

	layout=dot;

	// default values
	node  [shape=box, label="", fontname="sans-serif", style=filled, fillcolor=white, width=2.2, fontsize=8];
	graph [fontname="sans-serif"]; // must be specified separately
	edge  [fontname="sans-serif"]; // must be specified separately

	// an unobtrusive background color
	pad="1.0, 0.5";
	bgcolor=whitesmoke;

	// layout of edges and nodes
	splines=ortho;
	nodesep=0.3;
	ranksep=0.3;

	label="An example graph" fontsize=26;
	...
	...
Personal tools