0

Consider the manually drawn red arrow in this graph:

enter image description here

I want to tell graphviz to draw an arrow like that, although the particular path is not important. The important thing is that the existing graph not change at all. Essentially, I want to instruct graphviz to

  1. Draw a certain graph
  2. Keeping that graph fixed, add a new edge to it

Is this possible?

Jonah
  • 15,806
  • 22
  • 87
  • 161

1 Answers1

2

Yes, it should be possible.

If you have a certain graph (e.g. data.dot) and run this file through dot without specifying an output format, dot will output a dot file with added coordinates (attribute pos for nodes and edges). If you save this output (dot data.dot > data_pos.dot) you can add your new edge to it and you can generate your two output files.
You might have to enlarge the bounding box graph [bb="..."]; for the new edge not to mess with positions tho.

dgw
  • 13,418
  • 11
  • 56
  • 54
  • hmmm... adding some more edges now and it's messing with the existing positioning. changing the bb=[0,0,large_num,large_num] has no effect on overall image size. what else can i do? – Jonah Apr 23 '12 at 17:40
  • Have you tried adding the new nodes/edges with a `pos` attribute? – dgw Apr 23 '12 at 18:25
  • i would have to calculate all the pos numbers manually to do that, wouldn't i? what i want to tell graphviz is: "keep everything as is, with respect to position and size, then expand the canvas, now use that extra space as needed to draw the new edges that don't specifically specify pos coordinates" – Jonah Apr 23 '12 at 18:32
  • Ok, using `dot -Kneato -n2 input.dot` will fix the coordinates ... BUT neato will not try to fix overlapping. Still looking ... – dgw Apr 23 '12 at 19:32