How can I make dot (graphviz) layout unconnected nodes vertically instead of horizontally?
Asked Answered
R

1

6

I use pyreverse to create class diagrams from python code and this results in graphs like this:

enter image description here

as can be seen, some classes are not related. I would like to have the subgraphs laid out below each other so that I can include the image in a document.

Is there a simple way to modify a dot file so that disconnected parts of a graph are placed below each other?

Ricardo answered 9/10, 2018 at 18:4 Comment(0)
B
2

Connect the disconnected parts with invisible edges:

digraph so
{
    node[ shape = box ];
    A[ label = "Message" ];
    B[ label = "MetaMessage" ];
    C[ label = "TrainingMessage" ];
    D[ label = "MessageBundle" ];

    A -> { B C };
    { B C } -> D[ style = invis ];
}

yields

enter image description here

Billetdoux answered 10/10, 2018 at 4:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.