Can stress majorization in GraphViz's neato generate 3D layouts

I was referred to this forum from my posting on Stack Exchange [1]

I am looking at GraphViz’s neato graph layout utility [2]. It uses stress majorization [3], on which I found a paper [4]. I can’t say that I followed all the math, but it does seem formulated for laying out a graph in an arbitrarily high dimensional space. I am interested in generating node coordinates in 3D space, but I see no indication that this is supported in neato.

Does neato’s stress majorization generate 3D layouts?


[1] Can stress majorization in GraphViz's neato generate 3D layouts - Data Science Stack Exchange




Yes. There are 2 graph parameters related to this: dim and dimen. The former specifies how many dimensions should be used when positioning the nodes, i.e., running stress majorization. The second specifies how many dimension should be used when printing out the result. They can be set differently, but if you just set dimen, the same value is used for dim. See the dim and dimen notes on the Graphviz site.

For the common case of 3D, put the specification
in the graph or run neato with the flag -Gdimen=3.

Thank you, erg. When I use -Gdimen=3, I see the 3rd coordinate in the output. This is reassuring, as I did not see that when I used -Gdim=3.

I noted that the “dimen” controls the number of dimensions for “rendering”, while “dim” controls the number of dimensions for “layout”. This is the opposite of the meanings that I have assumed, i.e., that layout calculates coordinates while rendering prepares a nice picture. Are these defined anywhere?

Also, it would be nice for newbies if the “dim” help page refers to the “dimen” help page. Can I make this suggestion anywhere?

There should be an “edit this page” and “file documentation issue” button on each doc page

Thank you, Mark. I created a GitLab account as required and submitted the following request:

Please add to GraphViz documenation page for neato, specifically “-Gdim” and “-Gdimen” options

Readers of the “dim” page ( don’t necessarily know that setting “-Gdim=3” will be ineffective without setting “-Gdimen=3” (and in fact, only the latter is needed). The “dim” page should refer to the “dimen” page (

The “dimen” page explains the difference between “layout” and “rendering”, but I find it confusing. From looking at other graph layout models, I see “layout” as referring to the calculating the coordinates of the nodes. My common understanding of “rendering” is to create an image, e.g., with look and feel, such as texture, shape, colour, etc. The “dimen” page seems to conflate the two. Could this be clarified in the context of GraphViz? The reference from the “dim” page to the “dimen” page should explain that the descriptions are provided on the “dimen” page.

For your consideration…

Thank you.