microo8
microo8

Reputation: 3774

graphviz - fixed node positions

I have a graph that is processed by neato and I'm adding new edges to it. However, I don't want that the old nodes to be moved. I want that neato computes the new positions of the new nodes and the old nodes stay 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 the old nodes. For example:

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

How can I do that?

Upvotes: 11

Views: 12936

Answers (2)

Emden R Gansner
Emden R Gansner

Reputation: 161

You can pin a node's position by setting the node attribute pin=true.

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

Upvotes: 16

mihajlv
mihajlv

Reputation: 2315

Running it with -n option should do the trick.

Upvotes: 1

Related Questions