2011-05-18 67 views
17

我有這個圖:如何添加「無關」邊緣

digraph G { 
1 [label="car"]; 
2 [label="x"]; 
3 [label="car"]; 
4 [label="y"]; 
5 [label="cdr"]; 
6 [label="cdr"]; 
7 [label="cons"]; 
8 [label="x1"]; 
9 [label="x2"]; 
10 [label="cons"]; 
11 [label="y1"]; 
12 [label="y2"]; 
13 [label="f"]; 
14 [label="f"]; 
15 [label="car"]; 
16 [label="cdr"]; 
17 [label="car"]; 
18 [label="cdr"]; 
1 -> 2; 
3 -> 4; 
5 -> 2; 
6 -> 4; 
7 -> 8; 
7 -> 9; 
10 -> 11; 
10 -> 12; 
13 -> 2; 
14 -> 4; 
15 -> 7; 
16 -> 7; 
17 -> 10; 
18 -> 10; 
} 

,我要添加這些其它邊緣:

1 -> 3 [style="dashed"]; 
2 -> 7 [style="dashed"]; 
3 -> 8 [style="dashed"]; 
4 -> 10 [style="dashed"]; 
5 -> 6 [style="dashed"]; 
6 -> 9 [style="dashed"]; 
7 -> 10 [style="dashed"]; 
8 -> 11 [style="dashed"]; 
9 -> 12 [style="dashed"]; 
13 -> 14 [style="dashed"]; 
15 -> 8 [style="dashed"]; 
16 -> 9 [style="dashed"]; 
17 -> 11 [style="dashed"]; 
18 -> 12 [style="dashed"]; 

,但不改變佈局。 我嘗試將邊緣權重設置爲0,但它不起作用。

感謝

回答

20

你可以簡單地添加無關邊緣前加

edge[constraint=false]; 

沒有:

enter image description here

隨着邊緣:

graphviz non layout altering edges

(仍然顯得有些小的變化)

+0

非常感謝您!正是我需要的! – luomoradioattivo 2011-05-18 11:50:30

+2

爲了避免這個小的變化,甚至可以在第一個版本中添加所有的邊緣,但是對於虛線邊緣使用'style = invis',所以那些將不可見 – deeenes 2016-01-03 13:58:32