2011-04-23 51 views
5

這是生成的圖形的外觀目前: 這裏是該代碼:我怎樣才能得到點並排繪製連接的子圖?

digraph { 
    rankdir=TB; 
    subgraph cluster01 { 
    label="1.fázis" 

    aSTART; 
    node [shape = doublecircle]; a001; 
    node [shape = ellipse]; 

    aSTART -> a0 [ penwidth = 3 label = "0" ]; 
    a0 -> a00 [ penwidth = 3 label = "0" ]; 
    a00 -> a001 [ penwidth = 3 label = "1" ]; 


    a0 -> aSTART [ label = "1" ]; 
    a00 -> a00 [ label = "0" ]; 
    a001 -> a0 [ label = "0"]; 
    a001 -> aSTART [ label = "1"]; 
    aSTART -> aSTART [ label = "1"]; 
    } 
    subgraph cluster02 
    { 
    label="2.fázis" 
    bSTART; b1; b11; 
    node [shape = doublecircle]; b111; 
    node [shape = ellipse]; 

    bSTART -> b1 [ penwidth = 3 label = "1" ]; 
    b1 -> b11 [ penwidth = 3 label = "1" ]; 
    b11 -> b111 [ penwidth = 3 label = "1" ]; 

    b1 -> bSTART [ label = "0" ]; 
    b11 -> bSTART [ label = "0" ]; 
    b111 -> bSTART [ label = "0"]; 
    bSTART -> bSTART [ label = "0"]; 

    b111 -> b111 [label = "1"]; 
    } 

    subgraph cluster03 
    { 
    label="3.fázis"; 

    cSTART; c0; c1; c01; c10; 
    node [shape = doublecircle]; c010; c100; 
    node [shape = ellipse]; 

    cSTART -> c0 [ penwidth = 3 label = "0" ]; 
    c0 -> c01 [ label = "1" ]; 
    c01 -> c010 [ penwidth = 3 label = "0" ]; 

    cSTART -> c1 [ label = "1" ]; 
    c1 -> c10 [ penwidth = 3 label = "0" ];  
    c10 -> c100 [ label = "0" ];  

    c0 -> c1 [ penwidth = 3 label = "1" ]; 
    c01 -> c1 [ label = "1" ]; 
    c1 -> c1 [label = "1"]; 

    c10 -> c01 [ penwidth = 3 label = "1"]; 

    c010 -> c100 [penwidth = 3 label = "0"]; 
    c010 -> c01 [label = "1"]; 

    c100 -> c01 [label = "1"]; 
    c100 -> c0 [label = "0"]; 

    } 

    a001 -> b1 [color = "red" style = "dashed"]; 
    b111 -> c1 [color = "red" style = "dashed"]; 
} 

如果我刪除了2點紅色的線條,然後排隊的方式,我希望它:

我怎樣才能讓它像這樣排隊,同時有兩條紅線?

回答

4

您可以添加

{ 
    rank=same; 
    aSTART; 
    bSTART 
    cSTART; 
} 

你的子cluster03後。點會得到你一個警告,但平局喲所希望的方式:你應該使用的兩個紅邊的constraint=false屬性

D:\Code\funfunfun>dot -Tpng -oso1.png -Gcharset=latin1 so1.dot 
Warning: aSTART was already in a rankset, ignored in cluster _anonymous_0 
Warning: bSTART was already in a rankset, ignored in cluster _anonymous_0 
Warning: cSTART was already in a rankset, ignored in cluster _anonymous_0 

可用here

+0

太棒了!但爲什麼我們必須把它放在最後而不是開始呢? – 2011-04-27 09:50:57

+0

不知道,我有同樣的問題一會兒回來,我解決了它的實驗方式,所以我不能保證長期結果:) – Bruce 2011-04-27 10:00:44

2

修補的曲線圖。

如果爲false,則不使用邊緣對節點進行排序。

+0

嗯,這工作,但產生奇怪的「節點回避」行:http ://i55.tinypic.com/bg4c9g.png – 2011-04-27 09:54:19