Graphviz, Python and Tkinter

When creating a specific program that does one thing it is sometimes useful to provide a generic solution and build upon those foundations. This is what I present in todays posting, what I call graphing[1] .

Graphviz [2] is a great tool that allows you to create diagrams and flow-charts and almost any type of graph. I wont go into the details about Graphviz as this is not a tutorial, the site has more details.

What I have done is create a parser that converts a .gv file (e.g., [3, 4]) into a dot file (through the dot package) and then this is read to create the layout on a Tkinter Canvas in Python. The advantage to this is that you can add your own code and make these items interactive (e.g. mouse interactive, etc). You will need to install at least dot which is part of Graphviz[2].

Dependencies:
Graphviz (dot is needed)
Tkinter part of Python

Links Used:
[1] graphing by Konstantinos Xynos (2008) – http://www.comp.glam.ac.uk/staff/kxynos/dot_parser2Tk.zip
[2] Graphviz – http://www.graphviz.org/
[3] Example: Finite Automaton – http://www.graphviz.org/Gallery/directed/fsm.html
[4] Example: Finite Automaton gv file – http://www.graphviz.org/Gallery/directed/fsm.gv.txt

This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Graphviz, Python and Tkinter

  1. Amrita says:

    Hi !

    I would like to ask – ” Can Dot be installed in Unix/Linux Platform.

  2. Slyj says:

    Busted. I stand exposed as a Mac bigot by strniyag from the open platform manifesto. While the Mac implementation of graphviz is, indeed, open source, you can’t just run it on any OS it has to be OS X. My bad.If you are going to be doing a lot of work with network graphs, it may be worth it to use a Mac just for the ability to do interactive layouts. However.Here’s the magic sauce to produce the output:%dot -Tpdf -ocorr.pdf corr.dotfrom the directory where you have the corr.dot file.Then point your brower to the local file corr.pdf to view.Maximal culpa[WORDPRESS HASHCASH] The poster sent us ‘0 which is not a hashcash value.

Leave a Reply

Your email address will not be published. Required fields are marked *