Graphviz - fixed node positions

I have a graph that is being processed by neato, and I add new edges to it. However, I do not want the old nodes to be moved. I want neato to calculate the new positions of the new nodes, while the old nodes remain in the same place.

strict graph { node0 [pos="1,2"]; node1 [pos="2,3"]; } 

and I add new edges:

 strict graph { node0 [pos="1,2"]; node1 [pos="2,3"]; node1 -- node2 [len="3"]; ... } 

I want to get the same positions on old nodes. For example:

 strict graph { node0 [pos="1,2"]; node1 [pos="2,3"]; node2 [pos="3,4"]; ... } 

How can i do this?

+7
source share
2 answers

You can snap the position of a node by setting the node attribute pin=true .

Or put '!' at the end of the pos attribute: pos="34,12!"

+13
source

Running with the -n option should do the trick.

+1
source

All Articles