Is it possible to make the rank shuffle without using invisible edges?

Is it possible to make the nodes not align in a rank, but clump up with multiple ranks, or even shuffling inside a box? The nodes can be in a graph or a subgraph.


  • Must use dot layout
  • Must not use invisible edges

(Click to edit in the online editor)

Another suggested solution: Is it possible to have a subgraph using neato layout, while the whole graph using dot?

This is the part that I need to shuffle in my actual graph. The whole graph is a hierarchical graph, so dot is a must. These nodes does not need to take much space. Since there are many nodes like this, having an automatic solution is great.

Not sure that I fully understand the problem, but have you tried unflatten? (

Yes, it’s what I’m looking for. But unfortunately it doesn’t support Unicode characters

Just wonder why Graphviz doesn’t support multiple graph layout inside a graph? After all you have a graph inside the main bracket already

I struggle with non-ASCII characters, but unflatten seems to work correctly for me. How does my input differ from yours?

digraph U {
  eee -> {
  a [label="abc æ z"]
  d [label=" well ● ok"]

Command (Linux) f=unicode.gv; unflatten -l4 $f | dot -Tpng >o1.png

Using your code I get:

But that’s on PowerShell! If I use Bash I get:

[The forum software and/or my cut/paste technique messed up the input file, here is a correct version (I hope):]
unicode1.gv (431 Bytes)

Yea, It seems that unflatten can work for you!
Boo! It appears that you are fighting your OS (Windows?) and/or shells choices of fonts and/or interpretation of character strings. Ugh.
The bash version seems closer to “correct”, though both seemed to correctly present the Numeric character reference encodings (&#nnn;) (Numeric character reference - Wikipedia)
Please try my improved file. Also, please provide some or all of your source.

I didn’t know about unflatten… is there an API for this as well? How can I call unflatten when I use: graphviz as a library - Google Search?

hmm, this times it doesn’t work as expected. Perhaps because of the encoding format?

First I try the UTF-8 (your original file), then I convert it to UTF-8-BOM.



(dot.exe:27452): Pango-←[1;33mWARNING←[0m **: Invalid UTF-8 string passed to pango_layout_set_text()


(dot.exe:10364): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()



Error: unicode1.gv: syntax error in line 1 near 'digraph'


Error: .\unicode1.gv: syntax error in line 1 near 'digraph'

Here is my file: (64.0 KB)

No api, but you can always use a system call to invoke the program.

Thanks! I had a look myself. Indeed, the code is separate, only ready for command line. I’m in the process of transferring the code to my interface library as we speak. A bad hack for sure.

But, shouldn’t this code be part of a shared library and get an API? Without that it won’t be usable by non-command line use, like the WASM library here (which I intend to use for my web version). There seem to be a few more such tools like tred that aren’t accessible without command line.

I encourage you to create an issue here: Issues · graphviz / graphviz · GitLab