问题描述
我试图绘制一个图表,显示使用twopi的搜索前缀。我有一个简单的输入文件,并得到这个输出:
以下是输入文件:
digraph search {
// ordering = out;
// color = blue;
// rank = same;
// overlap = scale;
rankdir = LR;
root = root;
ranksep = 1.25;
overlap = true;
root;
a [color = none,fontsize = 12];
b [color = none,fontsize = 12];
c [color = none,fontsize = 12];
d [color = none,fontsize = 12];
e [color = none,fontsize = 12];
f [color = none,fontsize = 12];
#g [color = none,fontsize = 12];
h [color = none,fontsize = 12];
我[color = none,fontsize = 12];
j [color = none,fontsize = 12];
k [color = none,fontsize = 12];
l [color = none,fontsize = 12];
m [color = none,fontsize = 12];
n [color = none,fontsize = 12];
o [color = none,fontsize = 12];
p [color = none,fontsize = 12];
q [color = none,fontsize = 12];
r [color = none,fontsize = 12];
s [color = none,fontsize = 12];
t [color = none,fontsize = 12];
u [color = none,fontsize = 12];
v [color = none,fontsize = 12];
w [color = none,fontsize = 12];
x [color = none,fontsize = 12];
y [color = none,fontsize = 12];
#ga [color = none,fontsize = 12];
gb [color = none,fontsize = 12];
gc [color = none,fontsize = 12];
gd [color = none,fontsize = 12];
ge [color = none,fontsize = 12];
gf [color = none,fontsize = 12];
gg [color = none,fontsize = 12];
gh [color = none,fontsize = 12];
gi [color = none,fontsize = 12];
gj [color = none,fontsize = 12];
gk [color = none,fontsize = 12];
gl [color = none,fontsize = 12];
gm [color = none,fontsize = 12];
gn [color = none,fontsize = 12];
go [color = none,fontsize = 12];
gp [color = none,fontsize = 12];
gq [color = none,fontsize = 12];
gr [color = none,fontsize = 12];
gs [color = none,fontsize = 12];
gt [color = none,fontsize = 12];
gu [color = none,fontsize = 12];
gv [color = none,fontsize = 12];
gw [color = none,fontsize = 12];
gx [color = none,fontsize = 12];
gy [color = none,fontsize = 12];
gaa [color = none,fontsize = 12];
gab [color = none,fontsize = 12];
gac [color = none,fontsize = 12];
gad [color = none,fontsize = 12];
gae [color = none,fontsize = 12];
gaf [color = none,fontsize = 12];
gag [color = none,fontsize = 12];
gah [color = none,fontsize = 12];
gai [color = none,fontsize = 12];
gaj [color = none,fontsize = 12];
gak [color = none,fontsize = 12];
gal [color = none,fontsize = 12];
gam [color = none,fontsize = 12];
gan [color = none,fontsize = 12];
gao [color = none,fontsize = 12];
gap [color = none,fontsize = 12];
gaq [color = none,fontsize = 12];
#gaz [color = none,fontsize = 12];
gas [color = none,fontsize = 12];
gat [color = none,fontsize = 12];
gau [color = none,fontsize = 12];
gav [color = none,fontsize = 12];
gaw [color = none,fontsize = 12];
gax [color = none,fontsize = 12];
gay [color = none,fontsize = 12];
gaza [color = none,fontsize = 12];
gazb [color = none,fontsize = 12];
gazc [color = none,fontsize = 12];
gazd [color = none,fontsize = 12];
凝视[color = none,fontsize = 12];
#gazf [color = none,fontsize = 12];
gazg [color = none,fontsize = 12];
gazh [color = none,fontsize = 12];
gazi [color = none,fontsize = 12];
gazj [color = none,fontsize = 12];
gazk [color = none,fontsize = 12];
gazl [color = none,fontsize = 12];
gazm [color = none,fontsize = 12];
gazn [color = none,fontsize = 12];
gazo [color = none,fontsize = 12];
gazp [color = none,fontsize = 12];
gazq [color = none,fontsize = 12];
gazr [color = none,fontsize = 12];
gazs [color = none,fontsize = 12];
gazt [color = none,fontsize = 12];
gazu [color = none,fontsize = 12];
gazv [color = none,fontsize = 12];
gazw [color = none,fontsize = 12];
gazx [color = none,fontsize = 12];
gazy [color = none,fontsize = 12];
root - > a [minlen = 2];
root - > b [minlen = 2];
root - > c [minlen = 2];
root - > d [minlen = 2];
root - > e [minlen = 2];
root - > f [minlen = 2];
root - > g [minlen = 2];
root - > h [minlen = 2];
root - >我[minlen = 2];
root - > j [minlen = 2];
root - > k [minlen = 2];
root - > l [minlen = 2];
root - > m [minlen = 2];
root - > n [minlen = 2];
root - > o [minlen = 2];
root - > p [minlen = 2];
root - > q [minlen = 2];
root - > r [minlen = 2];
root - > s [minlen = 20];
root - > t [minlen = 2];
root - > u [minlen = 2];
root - > v [minlen = 2];
root - > w [minlen = 2];
root - > x [minlen = 2];
root - > y [minlen = 2];
root - > 0 [minlen = 2];
root - > 1 [minlen = 2];
root - > 2 [minlen = 2];
root - > 3 [minlen = 2];
root - > 4 [minlen = 2];
root - > 5 [minlen = 2];
root - > 6 [minlen = 2];
root - > 7 [minlen = 2];
root - > 8 [minlen = 2];
root - > 9 [minlen = 2];
root - > [minlen = 2];
g - > ga;
g - > gb;
g - > GC ;
g - > gd;
g - > ge;
g - > gf;
g - > gg;
g - > gh;
g - > gi;
g - > gj;
g - > gk;
g - > gl;
g - > gm;
g - > gn;
g - >走 ;
g - > gp;
g - > gq;
g - > gr;
g - > gs;
g - > gt;
g - >顾
g - > gv;
g - > gw;
g - > gx;
g - > gy;
ga - > gaa;
ga - > gab;
ga - > gac;
ga - >嘎嘎
ga - > gae;
ga - >加夫人
ga - >堵嘴
ga - > gah;
ga - >盖
ga - > gaj;
ga - > gak;
ga - >加仑
ga - >游戏
ga - >甘
ga - >高
ga - >差距
ga - > gaq;
ga - >煤气
ga - >加油站 ;
ga - > gat;
ga - > gau;
ga - >加夫
ga - > gaw;
ga - >嘎嘎
ga - >同性恋
gaz - >加沙
gaz - > gazb;
gaz - > gazc;
gaz - > gazd;
gaz - >凝视 ;
gaz - > gazf;
gaz - > gazg;
gaz - > gazh;
gaz - >加齐
gaz - > gazj;
gaz - > gazk
gaz - > gazl;
gaz - > gazm;
gaz - >加纳
gaz - >加索
gaz - > gazp;
gaz - >加斯加
gaz - > gazr;
gaz - >煤气
gaz - > gazt;
gaz - >加苏
gaz - > gazv;
gaz - >嘎嘎
gaz - > gazx;
gaz - >瞪大眼睛
gazo - > 蓝色星期二;
Blue Tuesday[fontsize = 10];
//布局引擎:circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
$ b}
这个输出产生于:
twopi -os1.png -Tpng s1 .dot
我在这里发帖,因为打印输出非常可怕。所有挂在gaz上的节点都是重叠的;我已经试过指定 nodesep
,它被简单地忽略。我希望看到从根部到单个字母的线条更加分离,但是我再次无法控制它。
这似乎是twopi中的一个错误。该文件表明,它应该明确地遵循这些指令,但它似乎并没有。
我的问题:
- 有没有办法让twopi行为?
- 如果没有,有更好的布局引擎可以使用吗?
-
size =7.75,10.25; //确保
整个图形符合一个8.5 x
11页面; > -
ranksep = 3.0; nodesep = 2.0;
-
已删除:root = root;和
overlap = true - 我为所有边缘设置了边缘权重等于0.1
:[weight = 0.1] - Is there any way to make twopi behave?
- Failing that, is there a better layout engine to use?
size="7.75,10.25"; // ensures thatentire graph fits on a single 8.5 x11 page;
orientation="landscape";
ranksep=3.0; nodesep=2.0;
deleted: "root=root"; and"overlap=true"
- i set the edge weight equal to 0.1for all edges: [weight=0.1]
ol>
谢谢。
我发现twopi是最难的适用于所有graphviz布局引擎。
我对原始点文件做了一些小改动。呈现的图形如下所示。
以下是差异:
图表属性:
边缘属性:
所有边缘的边缘权重减少90%具有增加边缘长度的净效果(或者更确切地说,放宽对边缘长度的限制);显然,这有助于节点扇出。这样做也增加了g和root之间的距离,给root的子节点更多空间。我还调整了一些纯粹的审美属性 - - 对布局没有任何影响,但对我而言,当您需要在单个页面上绘制中等密度的图时,似乎很重要:
图表属性:
fontname =Helvetica;
fontsize = 13
节点属性:
[color =lightsteelblue2,shape =diamond,[color =diamond,shape =diamond,style =filled]
ga[color =darkorange,shape =diamond,style =filled] b
gaz[color =bisque4,shape =diamond,style =filled]
:
[arrowsize = 0.4,penwidth = 1.2]
I am trying to draw a graph showing search prefixes using twopi. I have a simple input file and am getting this output:
alt text http://www.freeimagehosting.net/uploads/th.ac6cd51528.png(full image)
Here is the input file:
digraph search {
// ordering=out;
// color=blue;
// rank=same;
// overlap=scale;
rankdir=LR;
root=root;
ranksep=1.25;
overlap=true;
"root";
a [color=none,fontsize=12];
b [color=none,fontsize=12];
c [color=none,fontsize=12];
d [color=none,fontsize=12];
e [color=none,fontsize=12];
f [color=none,fontsize=12];
#g [color=none,fontsize=12];
h [color=none,fontsize=12];
i [color=none,fontsize=12];
j [color=none,fontsize=12];
k [color=none,fontsize=12];
l [color=none,fontsize=12];
m [color=none,fontsize=12];
n [color=none,fontsize=12];
o [color=none,fontsize=12];
p [color=none,fontsize=12];
q [color=none,fontsize=12];
r [color=none,fontsize=12];
s [color=none,fontsize=12];
t [color=none,fontsize=12];
u [color=none,fontsize=12];
v [color=none,fontsize=12];
w [color=none,fontsize=12];
x [color=none,fontsize=12];
y [color=none,fontsize=12];
#ga [color=none,fontsize=12];
gb [color=none,fontsize=12];
gc [color=none,fontsize=12];
gd [color=none,fontsize=12];
ge [color=none,fontsize=12];
gf [color=none,fontsize=12];
gg [color=none,fontsize=12];
gh [color=none,fontsize=12];
gi [color=none,fontsize=12];
gj [color=none,fontsize=12];
gk [color=none,fontsize=12];
gl [color=none,fontsize=12];
gm [color=none,fontsize=12];
gn [color=none,fontsize=12];
go [color=none,fontsize=12];
gp [color=none,fontsize=12];
gq [color=none,fontsize=12];
gr [color=none,fontsize=12];
gs [color=none,fontsize=12];
gt [color=none,fontsize=12];
gu [color=none,fontsize=12];
gv [color=none,fontsize=12];
gw [color=none,fontsize=12];
gx [color=none,fontsize=12];
gy [color=none,fontsize=12];
gaa [color=none,fontsize=12];
gab [color=none,fontsize=12];
gac [color=none,fontsize=12];
gad [color=none,fontsize=12];
gae [color=none,fontsize=12];
gaf [color=none,fontsize=12];
gag [color=none,fontsize=12];
gah [color=none,fontsize=12];
gai [color=none,fontsize=12];
gaj [color=none,fontsize=12];
gak [color=none,fontsize=12];
gal [color=none,fontsize=12];
gam [color=none,fontsize=12];
gan [color=none,fontsize=12];
gao [color=none,fontsize=12];
gap [color=none,fontsize=12];
gaq [color=none,fontsize=12];
#gaz [color=none,fontsize=12];
gas [color=none,fontsize=12];
gat [color=none,fontsize=12];
gau [color=none,fontsize=12];
gav [color=none,fontsize=12];
gaw [color=none,fontsize=12];
gax [color=none,fontsize=12];
gay [color=none,fontsize=12];
gaza [color=none,fontsize=12];
gazb [color=none,fontsize=12];
gazc [color=none,fontsize=12];
gazd [color=none,fontsize=12];
gaze [color=none,fontsize=12];
#gazf [color=none,fontsize=12];
gazg [color=none,fontsize=12];
gazh [color=none,fontsize=12];
gazi [color=none,fontsize=12];
gazj [color=none,fontsize=12];
gazk [color=none,fontsize=12];
gazl [color=none,fontsize=12];
gazm [color=none,fontsize=12];
gazn [color=none,fontsize=12];
gazo [color=none,fontsize=12];
gazp [color=none,fontsize=12];
gazq [color=none,fontsize=12];
gazr [color=none,fontsize=12];
gazs [color=none,fontsize=12];
gazt [color=none,fontsize=12];
gazu [color=none,fontsize=12];
gazv [color=none,fontsize=12];
gazw [color=none,fontsize=12];
gazx [color=none,fontsize=12];
gazy [color=none,fontsize=12];
root -> a [minlen=2];
root -> b [minlen=2];
root -> c [minlen=2];
root -> d [minlen=2];
root -> e [minlen=2];
root -> f [minlen=2];
root -> g [minlen=2];
root -> h [minlen=2];
root -> i [minlen=2];
root -> j [minlen=2];
root -> k [minlen=2];
root -> l [minlen=2];
root -> m [minlen=2];
root -> n [minlen=2];
root -> o [minlen=2];
root -> p [minlen=2];
root -> q [minlen=2];
root -> r [minlen=2];
root -> s [minlen=20];
root -> t [minlen=2];
root -> u [minlen=2];
root -> v [minlen=2];
root -> w [minlen=2];
root -> x [minlen=2];
root -> y [minlen=2];
root -> 0 [minlen=2];
root -> 1 [minlen=2];
root -> 2 [minlen=2];
root -> 3 [minlen=2];
root -> 4 [minlen=2];
root -> 5 [minlen=2];
root -> 6 [minlen=2];
root -> 7 [minlen=2];
root -> 8 [minlen=2];
root -> 9 [minlen=2];
root -> "." [minlen=2];
g -> ga ;
g -> gb ;
g -> gc ;
g -> gd ;
g -> ge ;
g -> gf ;
g -> gg ;
g -> gh ;
g -> gi ;
g -> gj ;
g -> gk ;
g -> gl ;
g -> gm ;
g -> gn ;
g -> go ;
g -> gp ;
g -> gq ;
g -> gr ;
g -> gs ;
g -> gt ;
g -> gu ;
g -> gv ;
g -> gw ;
g -> gx ;
g -> gy ;
ga -> gaa ;
ga -> gab ;
ga -> gac ;
ga -> gad ;
ga -> gae ;
ga -> gaf ;
ga -> gag ;
ga -> gah ;
ga -> gai ;
ga -> gaj ;
ga -> gak ;
ga -> gal ;
ga -> gam ;
ga -> gan ;
ga -> gao ;
ga -> gap ;
ga -> gaq ;
ga -> gaz ;
ga -> gas ;
ga -> gat ;
ga -> gau ;
ga -> gav ;
ga -> gaw ;
ga -> gax ;
ga -> gay ;
gaz -> gaza ;
gaz -> gazb ;
gaz -> gazc ;
gaz -> gazd ;
gaz -> gaze ;
gaz -> gazf ;
gaz -> gazg ;
gaz -> gazh ;
gaz -> gazi ;
gaz -> gazj ;
gaz -> gazk ;
gaz -> gazl ;
gaz -> gazm ;
gaz -> gazn ;
gaz -> gazo ;
gaz -> gazp ;
gaz -> gazq ;
gaz -> gazr ;
gaz -> gazs ;
gaz -> gazt ;
gaz -> gazu ;
gaz -> gazv ;
gaz -> gazw ;
gaz -> gazx ;
gaz -> gazy ;
gazo -> "Blue Tuesday" ;
"Blue Tuesday" [ fontsize=10];
// Layout engines: circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
}
This output is generated with:
twopi -os1.png -Tpng s1.dot
I'm posting here because the printout is pretty dreadful. All of the nodes hung of "gaz" are overlapping; I've tried specifying nodesep
and it is simply ignored. I would like to see the lines from root to the single letters further apart, but again, I can't control that.
This seems to be a bug in twopi. The documentation says it should clearly follow these directives, but it doesn't seem to.
My questions:
Thanks.
I have found twopi to be the most difficult to work with of all the graphviz layout engines.
I made a few small changes to your original dot file. The rendered graph is shown below.
Here are the diffs:
graph attributes:
edge attributes:
Reducing the edge weight by 90% for all edges has the net effect of increasing the edge length (or more precisely relaxing the constraint on edge length); obviously, this helps the nodes to "fan out". Doing this also increases the distance between "g" and "root", giving the child nodes of "root" more room.
I also tweaked a few purely aesthetic attributes--not having any effect on the layout, but that to me, seem to matter when you need to draw even a moderately dense graph on a single page:
graph attributes:
fontname="Helvetica";fontsize=13
node attributes:
"root" [color="goldenrod4", shape="diamond", style="filled"]
"g" [color="lightsteelblue2", shape="diamond", style="filled"]
"ga" [color="darkorange", shape="diamond", style="filled"]
"gaz" [color="bisque4", shape="diamond", style="filled"]
edge attributes:
[arrowsize=0.4, penwidth=1.2]
这篇关于使用graphviz twopi控制布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!