Home > python > drawing trees / graphs easily

drawing trees / graphs easily

You want to draw a binary tree / graph quickly. You’ve already used graphviz but you forgot its DOT language and you don’t want to read its documentation again. What do you do?

I found a nice Python project that does exactly this: pygraph.

Command to execute:

$ pygraph -u -e neato circle ab bc cd de ea

Output (circle.png):

See the project’s page for more examples and figures.

I sent a request to the author and he was kind to implement the --dot option that prints the .dot source in a file. This way you can easily tweak your graph. Don’t write the .dot file from scratch: do it quickly with pygraph, get a basic source, and refine it manually if necessary.

Categories: python Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: