2

我有一个有大约 20 个节点的有向图,我需要固定它们的位置。所以,我使用neato 来生成我的svg 文件。问题是如果我使用直线,我的边缘会与一些节点重叠。如果一组 -Gsplines=true -Gsep=1 边缘很好地避开了节点,但它们的相互节点(即来自 a -> b 和 b -> a 的节点)彼此重叠显示......下面是它的一部分,例如,边缘 9 -> 12 和 12 -> 完全重叠。有谁知道解决这个问题的方法?我可以使用穿过节点的直线,但如果我能设法避免它们并分别显示相互边缘,那将是理想的。不幸的是,使用纯点不是一个选项,因为节点的固定位置是必须的,因为我的最终目标是将它放在地图顶部(我' 我用inkscape“手工”做)。其他语言的解决方案(如果可能,请提供示例)也值得赞赏。

digraph {
7 [width=0.388723, shape=circle, style=filled,pos="-5.3642582,-2.953523!", color="#CCFFFF"];
9 [width=1.02852, shape=circle, style=filled,pos="-9.84668,4.0044438!", color="#CCFF00"];
12 [width=0.337023, shape=circle, style=filled,pos="-9.2490238,1.6804541!", color="#CC9933"];
13 [width=0.315507, shape=circle, style=filled,pos="-7.456055,0.035156!", color="#99FFCC"];
17 [width=0.164396, shape=circle, style=filled,pos="-7.2275394,1.8979026!", color="#33FF99"];

9 -> 7 [penwidth=0.644654, color="#CCFF00"];
9 -> 12 [penwidth=2.04003, color="#CCFF00"];
9 -> 13 [penwidth=1.10067, color="#CCFF00"];
9 -> 17 [penwidth=1.79226, color="#CCFF00"];
12 -> 9 [penwidth=0.5, color="#CC9933"];
12 -> 13 [penwidth=0.75431, color="#CC9933"];
12 -> 17 [penwidth=0.828487, color="#CC9933"];
13 -> 7 [penwidth=0.695661, color="#99FFCC"];
17 -> 13 [penwidth=1.78682, color="#33FF99"];
}
4

2 回答 2

1

这可能是特定版本的 graphviz 的问题 - 这是我使用 2.28 得到的输出,它没有显示您提到的问题。

我只是splines=true; sep=1;在图中添加了。

图形输出

于 2012-04-29T19:08:41.113 回答
0

对于这个数据样本,我已经安装了 2.28 版并得到了与您相同的结果。不幸的是,对于完整的集合,它崩溃了。没有 splines=true 它工作正常(直线重叠节点,像往常一样)。但是当我设置 splines=true, sep=1 时,它不会正确生成 svg。在没有 -Tsvg 的情况下运行它,我得到一个与内存相关的错误,开始如下:

 *** glibc detected *** neato: free(): invalid next size (normal): 0x0000000001e96c00  ***
 ======= Backtrace: =========
 /lib/x86_64-linux-gnu/libc.so.6(+0x7a6e6)[0x7f256f1856e6]
 /lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f256f1899cc]
 /usr/local/lib/graphviz/libgvplugin_neato_layout.so.6(freeRouter+0x3e)[0x7f256aa0095e]
 /usr/local/lib/graphviz/libgvplugin_neato_layout.so.6(+0x19e59)[0x7f256a9eee59]
 /usr/local/lib/graphviz/libgvplugin_neato_layout.so.6(splineEdges+0x24d)[0x7f256a9ef3fd]
 /usr/local/lib/graphviz/libgvplugin_neato_layout.so.6(neato_layout+0x532)[0x7f256a9ea6e2]
 /usr/local/lib/libgvc.so.6(gvLayoutJobs+0x91)[0x7f256f6dae61]
 neato[0x400f3c]
 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f256f12c30d]
 neato[0x400fad]
 ======= Memory map: ========

完整的图表是这个:

digraph {
 graph [size="16.68,8.55",resolution="72",bgcolor=transparent];
 1 [width=      0.10000000 shape=circle, style=filled,pos="     13.39800000,     -2.34524000!" color="#FFFFFF"];
 2 [width=      0.59517100 shape=circle, style=filled,pos="      1.70387000,      2.39732000!" color="#FFFFCC"];
 3 [width=      1.02015000 shape=circle, style=filled,pos="      0.71950000,      4.79922000!" color="#FF6600"];
 4 [width=      0.42447300 shape=circle, style=filled,pos="      4.54980430,      2.96880530!" color="#FFFF66"];
 5 [width=      0.86597700 shape=circle, style=filled,pos="      3.76904280,      5.57271100!" color="#FFCCCC"];
 6 [width=      1.51677000 shape=circle, style=filled,pos="     11.65283190,      3.98422860!" color="#FFCC33"];
 7 [width=      0.38872300 shape=circle, style=filled,pos="     -5.36425820,     -2.95352300!" color="#CCFFFF"];
 8 [width=      0.18210900 shape=circle, style=filled,pos="      7.01074180,      4.85747900!" color="#CCFF99"];
 9 [width=      1.02852000 shape=circle, style=filled,pos="     -9.84668000,      4.00444380!" color="#CCFF00"];
10 [width=      0.78439800 shape=circle, style=filled,pos="      0.15527310,      0.75367640!" color="#CCFFFF"];
11 [width=      0.58314700 shape=circle, style=filled,pos="      3.67089810,     -0.14061090!" color="#CC99FF"];
12 [width=      0.33702300 shape=circle, style=filled,pos="     -9.24902380,      1.68045410!" color="#CC9933"];
13 [width=      0.31550700 shape=circle, style=filled,pos="     -7.45605500,      0.03515600!" color="#99FFCC"];
14 [width=      2.10000000 shape=circle, style=filled,pos="      7.83691370,      2.19430460!" color="#99FF66"];
15 [width=      1.35638000 shape=circle, style=filled,pos="     11.44042930,      0.19332270!" color="#CC3399"];
16 [width=      0.37155900 shape=circle, style=filled,pos="      2.31738250,     -2.19430460!" color="#33FFFF"];
17 [width=      0.16439600 shape=circle, style=filled,pos="     -7.22753940,      1.89790260!" color="#33FF99"];
 1 ->   6[arrowshape=vee,penwidth=      0.76772236, color="#FFFFFF"];
 1 ->   7[arrowshape=vee,penwidth=      0.50000000, color="#FFFFFF"];
 1 ->  15[arrowshape=vee,penwidth=      0.57695912, color="#FFFFFF"];
 2 ->   3[arrowshape=vee,penwidth=      0.71351528, color="#FFFFCC"];
 2 ->   7[arrowshape=vee,penwidth=      0.98261125, color="#FFFFCC"];
 2 ->  10[arrowshape=vee,penwidth=      2.98429611, color="#FFFFCC"];
 3 ->   2[arrowshape=vee,penwidth=      3.10970125, color="#FF6600"];
 3 ->   4[arrowshape=vee,penwidth=      2.19246934, color="#FF6600"];
 3 ->   5[arrowshape=vee,penwidth=      3.48380699, color="#FF6600"];
 3 ->   8[arrowshape=vee,penwidth=      2.56421761, color="#FF6600"];
 3 ->   9[arrowshape=vee,penwidth=      0.86576911, color="#FF6600"];
 3 ->  10[arrowshape=vee,penwidth=      3.08433716, color="#FF6600"];
 3 ->  16[arrowshape=vee,penwidth=      1.50759938, color="#FF6600"];
 3 ->  17[arrowshape=vee,penwidth=      2.42768450, color="#FF6600"];
 4 ->   2[arrowshape=vee,penwidth=      3.52409026, color="#FFFF66"];
 4 ->   3[arrowshape=vee,penwidth=      1.16680621, color="#FFFF66"];
 4 ->   8[arrowshape=vee,penwidth=      2.83247875, color="#FFFF66"];
 4 ->  11[arrowshape=vee,penwidth=      3.18186134, color="#FFFF66"];
 4 ->  14[arrowshape=vee,penwidth=      3.71014548, color="#FFFF66"];
 4 ->  15[arrowshape=vee,penwidth=      1.33899072, color="#FFFF66"];
 5 ->   3[arrowshape=vee,penwidth=      0.83007122, color="#FFCCCC"];
 5 ->   8[arrowshape=vee,penwidth=      5.11512052, color="#FFCCCC"];
 6 ->   1[arrowshape=vee,penwidth=      1.05435052, color="#FFCC33"];
 6 ->   8[arrowshape=vee,penwidth=      2.17017566, color="#FFCC33"];
 6 ->  15[arrowshape=vee,penwidth=      1.78042048, color="#FFCC33"];
 7 ->  13[arrowshape=vee,penwidth=      1.70638297, color="#CCFFFF"];
 8 ->   5[arrowshape=vee,penwidth=      3.21975483, color="#CCFF99"];
 9 ->  12[arrowshape=vee,penwidth=      2.47722286, color="#CCFF00"];
 9 ->  13[arrowshape=vee,penwidth=      1.41201772, color="#CCFF00"];
 9 ->  17[arrowshape=vee,penwidth=      2.31502497, color="#CCFF00"];
10 ->   2[arrowshape=vee,penwidth=      1.44435627, color="#CCFFFF"];
10 ->   7[arrowshape=vee,penwidth=      1.03121586, color="#CCFFFF"];
10 ->  16[arrowshape=vee,penwidth=      1.50003087, color="#CCFFFF"];
11 ->  10[arrowshape=vee,penwidth=      1.72840183, color="#CC99FF"];
11 ->  16[arrowshape=vee,penwidth=      2.13382591, color="#CC99FF"];
12 ->   9[arrowshape=vee,penwidth=      0.73349271, color="#CC9933"];
12 ->  13[arrowshape=vee,penwidth=      1.50699757, color="#CC9933"];
13 ->   7[arrowshape=vee,penwidth=      1.39745583, color="#99FFCC"];
13 ->  17[arrowshape=vee,penwidth=      1.13347078, color="#99FFCC"];
14 ->   4[arrowshape=vee,penwidth=      1.30211157, color="#99FF66"];
14 ->   5[arrowshape=vee,penwidth=      1.00132679, color="#99FF66"];
15 ->   1[arrowshape=vee,penwidth=      1.32443039, color="#CC3399"];
15 ->   4[arrowshape=vee,penwidth=      1.63346112, color="#CC3399"];
15 ->   6[arrowshape=vee,penwidth=      2.27386028, color="#CC3399"];
15 ->  14[arrowshape=vee,penwidth=      2.67493819, color="#CC3399"];
16 ->  10[arrowshape=vee,penwidth=      3.33223069, color="#33FFFF"];
16 ->  11[arrowshape=vee,penwidth=      3.32587861, color="#33FFFF"];
17 ->   3[arrowshape=vee,penwidth=      0.88032271, color="#33FF99"];
17 ->   9[arrowshape=vee,penwidth=      0.56000418, color="#33FF99"];
17 ->  13[arrowshape=vee,penwidth=      2.95412645, color="#33FF99"];
}
于 2012-04-30T23:48:24.220 回答