GraphViz不尊重rankdir

时间:2017-07-20 17:11:22

标签: graphviz

所以我正在编写一些graphviz代码来生成48阶组的子组点阵,总共有98个子组(计算普通组和整个组)。所以我使用不可见节点按照子组的顺序对它们进行排序,就像我过去对较小的例子所做的那样,但是这次发生了奇怪的事情,它排在同一行的4阶和8阶子组,同样顺序6虽然明确地将所有相关的顺序与有向边连接并且在开始时设置了rankdir,但是这12个子组是有序的。 GraphViz代码:

digraph G{
rankdir = "BT" ;
node [shape=plaintext] Order1 -> Order2 -> Order3 -> Order4 -> Order6 -> Order8 -> Order12 -> Order16 -> Order24 -> Order48 [style=invis];
{rank = same Order1; Subgroup1}
{rank = same Order2; Subgroup2 ; Subgroup3 ; Subgroup4 ; Subgroup5 ;     Subgroup6 ; Subgroup7 ; Subgroup8 ; Subgroup9 ; Subgroup10 ; Subgroup11 ; Subgroup12 ; Subgroup13 ; Subgroup14 ; Subgroup15 ; Subgroup16 ; Subgroup17 ; Subgroup18 ; Subgroup19 ; Subgroup20}
{rank = same Order3; Subgroup21 ; Subgroup22 ; Subgroup23 ; Subgroup24}
{rank = same Order4; Subgroup25 ; Subgroup26 ; Subgroup27 ; Subgroup28 ; Subgroup29 ; Subgroup30 ; Subgroup31 ; Subgroup32 ; Subgroup33 ; Subgroup34 ; Subgroup35 ; Subgroup36 ; Subgroup37 ; Subgroup38 ; Subgroup39 ; Subgroup40 ; Subgroup41 ; Subgroup42 ; Subgroup43 ; Subgroup44 ; Subgroup45 ; Subgroup46 ; Subgroup47 ; Subgroup48 ; Subgroup49 ; Subgroup50 ; Subgroup51 ; Subgroup52 ; Subgroup53 ; Subgroup54 ; Subgroup55}
{rank = same Order6; Subgroup56 ; Subgroup57 ; Subgroup58 ; Subgroup59 ; Subgroup60 ; Subgroup61 ; Subgroup62 ; Subgroup63 ; Subgroup64 ; Subgroup65 ; Subgroup66 ; Subgroup67}
{rank = same Order8; Subgroup68 ; Subgroup29 ; Subgroup70 ; Subgroup71 ; Subgroup72 ; Subgroup73 ; Subgroup74 ; Subgroup75 ; Subgroup76 ; Subgroup77 ; Subgroup78 ; Subgroup79 ; Subgroup80 ; Subgroup81 ; Subgroup82 ; Subgroup83 ; Subgroup84 ; Subgroup85 ; Subgroup86}
{rank = same Order12; Subgroup87 ; Subgroup88 ; Subgroup89 ; Subgroup90 ; Subgroup91}
{rank = same Order16; Subgroup92 ; Subgroup93 ; Subgroup94}
{rank = same Order24; Subgroup95 ; Subgroup96 ; Subgroup97}
{rank = same Order48; Subgroup98}
Order1[label=""];
Order2[label=""];
Order3[label=""];
Order4[label=""];
Order6[label=""];
Order8[label=""];
Order12[label=""];
Order16[label=""];
Order24[label=""];
Order48[label=""];
Subgroup1[shape=ellipse, peripheries=1, label="(1,1)"];
Subgroup2[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup3[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup4[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup5[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup6[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup7[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup8[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup9[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup10[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup11[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup12[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup13[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup14[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup15[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup16[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup17[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup18[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup19[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup20[shape=ellipse, peripheries=1, label="(2,1)"];
Subgroup21[shape=ellipse, peripheries=1, label="(3,1)"];
Subgroup22[shape=ellipse, peripheries=1, label="(3,1)"];
Subgroup23[shape=ellipse, peripheries=1, label="(3,1)"];
Subgroup24[shape=ellipse, peripheries=1, label="(3,1)"];
Subgroup25[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup26[shape=ellipse, peripheries=1, label="(4,1)"];
Subgroup27[shape=ellipse, peripheries=1, label="(4,1)"];
Subgroup28[shape=ellipse, peripheries=1, label="(4,1)"];
Subgroup29[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup30[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup31[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup32[shape=ellipse, peripheries=1, label="(4,1)"];
Subgroup33[shape=ellipse, peripheries=1, label="(4,1)"];
Subgroup34[shape=ellipse, peripheries=1, label="(4,1)"];
Subgroup35[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup36[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup37[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup38[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup39[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup40[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup41[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup42[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup43[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup44[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup45[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup46[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup47[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup48[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup49[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup50[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup51[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup52[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup53[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup54[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup55[shape=ellipse, peripheries=1, label="(4,2)"];
Subgroup56[shape=ellipse, peripheries=1, label="(6,1)"];
Subgroup57[shape=ellipse, peripheries=1, label="(6,1)"];
Subgroup58[shape=ellipse, peripheries=1, label="(6,1)"];
Subgroup59[shape=ellipse, peripheries=1, label="(6,1)"];
Subgroup60[shape=ellipse, peripheries=1, label="(6,1)"];
Subgroup61[shape=ellipse, peripheries=1, label="(6,1)"];
Subgroup62[shape=ellipse, peripheries=1, label="(6,1)"];
Subgroup63[shape=ellipse, peripheries=1, label="(6,1)"];
Subgroup64[shape=ellipse, peripheries=1, label="(6,2)"];
Subgroup65[shape=ellipse, peripheries=1, label="(6,2)"];
Subgroup66[shape=ellipse, peripheries=1, label="(6,2)"];
Subgroup67[shape=ellipse, peripheries=1, label="(6,2)"];
Subgroup68[shape=ellipse, peripheries=1, label="(8,5)"];
Subgroup69[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup70[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup71[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup72[shape=ellipse, peripheries=1, label="(8,5)"];
Subgroup73[shape=ellipse, peripheries=1, label="(8,5)"];
Subgroup74[shape=ellipse, peripheries=1, label="(8,5)"];
Subgroup75[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup76[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup77[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup78[shape=ellipse, peripheries=1, label="(8,2)"];
Subgroup79[shape=ellipse, peripheries=1, label="(8,2)"];
Subgroup80[shape=ellipse, peripheries=1, label="(8,2)"];
Subgroup81[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup82[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup83[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup84[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup85[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup86[shape=ellipse, peripheries=1, label="(8,3)"];
Subgroup87[shape=ellipse, peripheries=1, label="(12,4)"];
Subgroup88[shape=ellipse, peripheries=1, label="(12,4)"];
Subgroup89[shape=ellipse, peripheries=1, label="(12,4)"];
Subgroup90[shape=ellipse, peripheries=1, label="(12,4)"];
Subgroup91[shape=ellipse, peripheries=1, label="(12,3)"];
Subgroup92[shape=ellipse, peripheries=1, label="(16,11)"];
Subgroup93[shape=ellipse, peripheries=1, label="(16,11)"];
Subgroup94[shape=ellipse, peripheries=1, label="(16,11)"];
Subgroup95[shape=ellipse, peripheries=1, label="(24,12)"];
Subgroup96[shape=ellipse, peripheries=1, label="(24,12)"];
Subgroup97[shape=ellipse, peripheries=1, label="(24,13)"];
Subgroup98[shape=ellipse, peripheries=1, label="(48,48)"];
}

我还没有为子组成员关系添加代码,部分原因是我不想做所有这些工作,除非我能真正解决这个排名问题。

(旁注:我不得不手动为每一行添加4个空格,因为它不会复制+粘贴正确,似乎将我的graphviz代码中的换行符误认为是换行符,从而结束了代码块,我该如何避免这在将来?)

1 个答案:

答案 0 :(得分:2)

Subgroup29与Order4和Order8的排名相同,使Order4有效地使Order4和Order8具有相同的排名,重命名其中一个事件解决了问题