2009-09-25 77 views
19

我想使用的graphviz來模擬一定的流量,我無法弄清楚如何在下圖模型共享相同的水平中心如何強制graphviz中同一列中的所有節點?

digraph exmp { 
    A -> B -> C -> D 
    C -> E [constraint=false] 
    A -> C [style="dotted", constraint=false] 
    A -> D [style="dotted", constraint=false] 
    B -> D [constraint=false] 
    D -> A [style="dashed", constraint=false] 
    C -> A [style="dashed", constraint=false] 


    subgraph cluster_hackToSinkIt { E -> F } 
    { rank="sink" E F } 
} 

這導致如下圖:

rendered image

我的問題是,我怎麼能讓E - > F被定位在D之下,使得它位於同一列?

+0

圖像現在壞了。我試圖重新創建它,但我從graphviz得到錯誤 – 2014-04-09 07:01:05

回答

25

至少as of May 2007,你不能強迫「列」 本身,但你可以申請重量邊緣,這應有助於力對齊。但實際上,在這種情況下,如果您只是添加了一個從D到E的不可見邊緣,則您將獲得垂直對齊。

digraph exmp { 
    A -> B -> C -> D 
    C -> E [constraint=false] 
    A -> C [style="dotted", constraint=false] 
    A -> D [style="dotted", constraint=false] 
    B -> D [constraint=false] 
    D -> A [style="dashed", constraint=false] 
    C -> A [style="dashed", constraint=false] 
    D -> E [style="invis"] // <---- important new line 


    subgraph cluster_hackToSinkIt { E -> F } 
    { rank="sink" E F } 
} 

fixed dot image

我不知道有任何辦法強迫邊緣一側或另一側。

+0

我已經刪除了有關如何強制邊緣的問題,並將爲此創建一個新問題。否則很難判斷哪個答案是正確的答案。 – 2009-09-25 14:00:57

相關問題