Graphviz: break flat but sparsely connected graph into multiple rows?
Asked Answered
B

2

14

Howto break a flat but sparsely connected graphviz graph into multiple rows?

Graphviz yields a graph of about 4 ranks, but over 9000 nodes wide. However since the graph is sparsely connected we could break it in to rows, for example each 1000 nodes, and thus make it fit on nine rows one page. How can this be done?

Not looking for unflatten, but rather something like line breaks in a text editor (is it clear what I am looking for?).

Edit: PDF with example graph here

Breannabreanne answered 26/8, 2009 at 13:27 Comment(3)
For someone very used to graph layout problems, I think it's pretty clear. The rest of us would love an image showing the problem case and the desired goal. A mockup hand-drawn sketch would suffice, of course.Slung
the link is 404Onetoone
why do you not like unflatten?Onetoone
C
0

Yes I guess you want a mechanism like the one that is implemented in unflatten.

The Graphviz dot layout algorithm is quite deterministic. It will produce the same layout for the same input topology. If the structure of your input graph is "wide and shallow", then this is what your final diagram will look like. dot does not support layout directives like "line break here, please" or "max-width: 1000 nodes".

unflatten (for example) modifies the input graph by adding invisible 'helper' edges. You don't see those edges in the final output. They create a different, intermediate graph. This graph is in deed less wide and less shallow, because the 'helper' edges change the topology. That's why it looks like there were "line breaks" in otherwise long running rows.

You can achieve the same result by placing such invisible edges yourself in the input graph. This way you can could implement your own topology transformer which is smarter than the 2 strategies that unflatten follows.

If you provide some example dot source, or a fix for your broken pdf link, then we could look into these.

Also please explain why you don't want to use unflatten: is it not available to you or don't you like its results?

Chestonchest answered 17/7, 2024 at 20:11 Comment(0)
S
-1

Like GraphViz Documentation, section 2.5: Node and Edge Placement, like Figure 9: Graph with constrained ranks?

http://www.graphviz.org/pdf/dotguide.pdf

Sharpshooter answered 26/8, 2009 at 13:59 Comment(1)
Thanks for the pointer! But as far as I see I cannot put a subgraph below another without a third one to align them. And also, I would have to do this manually, ie having to know the connected components in advance and decide manually which one to put on the same row. I would rather like to have something that uses dot to align the subgraphs and then neato to layout all subgraphs.Breannabreanne

© 2022 - 2025 — McMap. All rights reserved.