post processing

I have a program which generates a perfectly valid dot file and I am able to build a jpg graph after it. However, I would like to make changes to the graphs, such as spacing, shapes and hopefully I am able to collapse parent and children nodes since its a large graph (500+ nodes).

Is it possible to do this? Or do I need to use a programming language such as Python to read the dot file and then do my own parsing? Can dot do it natively?

The layout programs do just

The layout programs do just that: layout (and optionally render). Unfortunately we don't provide a GUI editor, so you would have to make changes by altering the input graph as represented in the DOT language. (One of the interactive viewers listed at http://www.graphviz.org/content/resources may provide something like that, but I'm not sure.) There are lots of mechanisms for reading a graph and tweaking it using a program.

  1. You can link a program to the Graphviz cgraph library, then read in a graph, make the alterations, and write it out (or invoke the Graphviz layout programs to do the layout).
  2. You can use a scripting language like python along with the appropriate library to read and alter the graph, etc. Look under the Language Binding section of http://www.graphviz.org/content/resources for the available packages. Also, depending on how you built or got Graphviz, we provide swig-based  bindings for a variety of languages such as java, lua, perl, python, ruby and tcl.
  3. For many tasks, the simplest solution is to use the gvpr filter provided by Graphviz. As the standard read/traverse/write control is built in, one can write fairly terse operations for tweaking a graph.

This is just a high-level description. If you want more details about any of these, let me know.