Set positions of Node

I am new to GraphViz and I was trying to set the positions of the node so that I can get my preferred orientation. But I couldn't get any help. Is there any way I can set the co-ordinates of the nodes or any other alternative?

Most of the Graphviz layout

Most of the Graphviz layout algorithms ignore position information. Indeed, setting initial positions doesn't fit well with what the algorithms are trying to do. The general idea is to specify more abstract constraints and then let the algorithm do its best. That said, neato and fdp do allow you to provide initial position information. Simply set the pos attribute in your input graph. For example,

graph G { abc [pos="200,300"] }

(If you run fdp or neato, use the -s flag to make sure the coordinates are interpreted as point values. Also, if you provide positions, you may find neato -Kmode=KK better.) For more information, see

If you know all of the node positions, you can use neato -n or neato -n2 (without -s) to do edge routing followed by rendering.

That was a great help. Thanks

That was a great help. Thanks a lot. Using this I'm still facing one problem. If there are a lot of nodes and edges, is there any way I can tell the algorithm to position the edge labels so that they don't get intermingled with other edge labels? Also is it possible to draw bent edge using "neato"

If you are using a recent

If you are using a recent version of Graphviz, and using neato -n to do the edges, it should attempt to place the edge labels not to overlap other labels or any nodes. First, this is not always possible; there may just not be enough room. Second, our current algorithm is an initial implementation and probably could be improved.

When you run neato (or any of the layouts), you control the type of edge routing using the splines attribute. See for more details.

Recent comments