Generating graphviz input using python

By Andreas Wilhelm Apr 1, 2013

In my last pots “Using graphviz to draw graphs”, I talked about how to use graphviz to visualize graphs like the one below.


And today I would like to show you how easy it is to extend your own programs to generate code that could be translated by graphviz to a nice looking graph.

Using graphviz to draw graphs

By Andreas Wilhelm Mar 30, 2013

Many domains of applied computer science and numerics are engaged with graph theory. So if you participate in a lecture or seminar about theoretical informatics, you will often work with deterministic or nondeterministic finite-state machines. Or if you talking about Complexity theory, you will often hear of graph problems like Travelling salesman problem (eg. TSP) or the Clique problem.

This is all ver interesting, but you often get in trouble if you are looking for an easy to use library or software tool to create graphics from such graphs. As I create all worksheets, presenations and handouts using Latex (not PdfLatex), I was looking for an easy to use library that creates the graphics based on a very simple grammar. So I came first up with the Latex package pstricks (I will cover this in a future post), but it was to complex for my needs and I was locking for something which I could easily integrate into software projects. And after some hours of googling I found graphviz.

Graphviz is an open source software that uses structured information, a simple grammar, called DOT language, to visualize graphs, diagrams or networks. So it is a perfect tool to create graphics for any kind of presentation to visualize computer networks, deterministic or nondeterministic finite state machines, interface specifications, entity relationship models (ERMs) and flow or timing charts. Although it supports various output formats like *.jpg, *.svg, *.pdf or *.eps, which is perfect if you are working with Latex. Furthermore there are thousands of options that could be used to improve your graphics. So you could change the colors or shapes of a diagramm, adjust the line styles, add a legend or hyperlink and change the arrow or node style.

To install graphiz on an Ubuntu system just run the command below:

sudo apt-get install graphviz

To demonstrate the usage of graphviz I dig out an old exercise of my computer and network security course. The task was to draw a keyword tree for the strings “lol”, “loy”, “orly”, “yolo” and “yoyo”. So I created the keyword tree shown in the graphic below.

A keyword tree using graphviz

Migrating email accounts using imapsync

By Andreas Wilhelm Mar 29, 2013

Yesterday I moved my domain to a new Strato server. But since I hosted different mail accounts for different purposes, like one general account, one for friends and one for ebay etc., I had to migrate them to the new server. Fortunately I found imapsync, a very easy to use software that allows the user to move all emails from one account to another using the imap protocol.

To get started you have to install some packages needed by imapsync

sudo apt-get install libdate-manip-perl libterm-readkey-perl libterm-readkey-perl libdigest-hmac-perl libdigest-hmac-perl libdate-manip-perl libmail-imapclient-perl

and some packages needed to install the latest version of imapsync from the github project:

sudo apt-get install makepasswd rcs perl-doc libmail-imapclient-perl make git-core git-doc git-svn git-gui gitk

After that you could download the source code of the latest version from the github project into the /tmp directory:

cd /tmp
git clone git://

is a Computer Science MSc. interested in hardware hacking, embedded Linux, compilers, etc.