本文介绍了如何使用graphviz设置“弹簧"力以实现紧凑的图形布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 graphviz 生成图,但是我遇到了问题-有几个非常大的节点-和大量的小节点.我尝试使用 neato fdp ,但两者均会生成非常大的图形,大部分都是空白的(节点是相隔很远).有没有办法为这些工具设置更大的弹簧强度",以迫使节点靠得更近?

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?

推荐答案

使用neato时,您可能会摆弄overlapsep属性.

When using neato, you may fiddle with the overlap and with the sep attribute.

overlap设置为falsecompressscalexy更多.

sep 可以指定加法边距当与前面的加号一起使用时,否则通过将节点的大小缩放为1 + sep的值来定义边距.似乎是默认

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;

这篇关于如何使用graphviz设置“弹簧"力以实现紧凑的图形布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:58