Drawing Edges on a 'locked' graph

here's my dillema:
I'm working on graphs for scientific workflows, and I'm using clusters to represent computational operations. I can get the graph to generate in the desired shape. I've included a the dot file for this as 'execution.txt'.

Now I need to draw edges on top of this graph (in a different color) to show different dependencies between tasks, but I need theses edges to not destroy the layout. IE, I want to preserve the shape of the graph before I overlay these new edges. What I get is something like 'full.txt' (this is also a dot).

Is there a way to lock the layout at a certain point and have graphviz simply draw edges over an existing graph?

Many thanks in advance.

execution.txt7.77 KB
full.txt10.58 KB

dot is always going to take

dot is always going to take its input graph and do a new layout. The neato layout provides the -n option to retain node positions. So, to get what you want, do:

   dot execution.txt > ex0.txt

add new edges to ex0.txt

   neato -n2 -Tpng ex0.txt > ex0.png

The -n2 option tells neato to use any edge routes already in the input. Otherwise, it will regenerate all edges. You can also use the splines attribute to determine what style of edges you want to use.

Note also that there are lots of ways to avoid adding the new edges by hand. One way is to use gvpr to read in an edge set and add them to the input graph. Alternatively, you can put all of the edges into the original graph, but give each edge a tag attribute. You can them use gvpr to filter out edges you don't want in a given layout. For example, suppose execution.txt contains its edges and those in full.txt, with the former having tag=0 and the latter having tag=1. You can then do

gvpr -c 'E[tag=="0"]' execution.txt | dot > ex0.gv    // only tag 0  edges are used

neato -n2 -Tpng ex0.gv > ex0.png                        // all edges are used with node positions fixed


Recent comments