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.

Requirements:

  • Must use dot layout
  • Must not use invisible edges

(Click to edit in the online editor)
http://magjac.com/graphviz-visual-editor/?dot=digraph%20G%20%7B%0Arank%3Dsink%0Aa%0Ab%0Ac%0Ad%0Ae%0Af%0Ag%0Ah%0A%0Asubgraph%20cluster_1%20%7B%0Alabel%3D%22bla%22%20%0Acolor%3Dblue%0Anode%20%5B%20shape%3Dplain%20fillcolor%3Dwhite%20%5D%0Ai%0Aj%0Ak%0Al%0Am%0An%0Ao%0Ap%0A%7D%0A%7D

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? (https://graphviz.org/pdf/unflatten.1.pdf)

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?
Input:

digraph U {
  eee -> {
  a [label="abc æ z"]
  2[label="ü?"];
  3[label="ä?"];
  4[label="ö?"];
  d [label=" well ● ok"]
 }
}

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

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.

UTF-8

Bash

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

PowerShell

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

UFT8-BOM

Bash

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

PowerShell

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

Here is my file: ooker.dot (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