Visualizing Graphs mit Graphviz (and LaTeX) – Part I

This entry is part 1 of 2 in the series GraphViz

This is the first article in a series to describe Graphviz, an amazing tool to generate org charts and relationship diagrams, and ways to work with it from LaTeX. (I need to compile a huge set of slides so my intention is to save some time by automating the process)

I knew of its existence for quite a while but never managed to take anough time to get a closer look. Driven by my job however (the setup of a Private Equity fund of funds involves different legal entities) I decided to give it a try.

Graphviz was developed at the famous AT&T labs and released under Eclipse Public License. It consists of a set of binary tools that are able tranform Graphviz’s description language DOT into graphics.

Until further notice I will use dot, one of the binaries, to transform the examples into PNG. There are other converters like neato, which differ from dot in the way they calculate the distances between the nodes, etc.

Working with Graphviz involves defining nodes and edges between them. See the following, non-minimal example. I use a digraph (other types like e.g. graph are available but I didn’t look up the differences so far), define two nodes a and b and and edge between them.

digraph G{
a [label="Node A"];
b [label="Node B"];
a->b[label=" An edge"];
}

Using the command dot -Tpng nameoffile.gv I get the following PNG:

basic.gv

The above example is a bit more sophisticated than the minimal working example:

digraph G{
hello->world;
}

minimal.gv

Series NavigationVisualizing Graphs mit Graphviz (and LaTeX) – Part II >>

Uwe

Uwe Ziegenhagen mag LaTeX und Python, auch gern in Kombination. Hat Dir dieser Beitrag geholfen und möchtest Du Dich dafür bedanken? Dann unterstütze doch vielleicht die Dingfabrik Köln e.V. mit einem kleinen Beitrag. Details zur Bezahlung findest Du unter Spenden für die Dingfabrik.

More Posts - Website