I'm generating diagram with graphviz and I have a problem - there are several nodes that are very large - and large number of small nodes. I tried generating png with neato and fdp but both generate very large graphics, which are mostly blank (nodes are very far apart). Is there a way to set a larger spring 'strength' for these tools to force nodes closer together?
How to set the 'spring' force with graphviz for compact graph layouts
Knowing this post is very old: if using sfdp/fdp, there's an attribute called K, which serves for this purpose. –
Olivette
When using neato, you may fiddle with the overlap
and with the sep
attribute.
overlap
can be set to false
, compress
, scalexy
, and more.
sep
may either designate an additive margin when used with a preceding plus sign, otherwise the margin is defined by scaling the node's size with 1 + the value of sep
. It seems that the default
Don't hesitate to post a sample graph. Not knowing your particular graph, I made an example containing some big and some small nodes:
layout=neato;
overlap=scalexy; //false, compress, ...
sep="+1"; // 0.1, +1
node[label="Large node", width=2, height=2];
l1; l2; l3;
node[label="\N", width=0.5, height=0.3];
1 -> l1;
2 -> l1;
3 -> l1;
4 -> l1;
5 -> l1;
5 -> l2;
6 -> l2;
7 -> l2;
8 -> l2;
8 -> l3;
9 -> l3;
10 -> l3;
sep="+1" fixed for "Found unexpected character '+' " –
Highkey
@Highkey looks like now you have to put it between quotes
sep="+1";
–
Nomadize © 2022 - 2024 — McMap. All rights reserved.