When one has a graphviz directed graph that is best suited to arrange using dot, is there a way to get around the issue of a large node creating excess padding around other nodes of the same rank?
For example, with the following graph:
digraph {
b[label="line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n"];
a -> b;
a -> c;
b -> f;
c -> d;
d -> e;
e -> f;
}
The graph is obviously taller than necessary due to the left-hand path increasing the height of a rank that doesn't need to be so tall in the right-hand path.
Is there perhaps a way to do layout the two paths separately? I thought using cluster subgraphs might help, but it seems that rank heights are completely global even in that case.
I'm hoping for a result akin to this image edit (please excuse it's crudeness):
As a workaround you may try to add edge[constraint = false];
.
This will set constraint
attribute value for all edges:
Or specify constraint
attribute only for some of edges.
EDIT: Quite close result we can achieve with the help of subgraphs:
digraph {
rankdir = LR;
b[label="line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n"];
subgraph cluster_0 {
rank = same;
style = invis;
a -> c -> d -> e -> f [constraint = false];
}
a -> b;
b -> f;
}
Will be rendered as follows:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With