2017-05-29 135 views
0

如何將所有「平行四邊形」[請參見我的代碼]放置在帶有graphviz點語言的S盒頂部?graphviz改變有向圖中特定形狀的方向

所以基本上輸出應該看起來像一條直線,圖上方的所有M1 M2和Mn。

實際輸出: enter image description here 希望的輸出: enter image description here

digraph ER { 

node [group=M; shape=parallelogram]; M1; M2; M_n; 
node [group=I, shape=none]; "..."; 
node [group=V, shape=egg]; IV; V1; V2; 
node [group=C, shape=box]; "S1"; "S2"; "S_n"; f; 
node [group=F, shape=hexagon]; "FINAL"; 


    IV -> "S1"; 
    M1 -> "S1"; 
    "S1" -> V1; 
    V1 -> "S2"; 
    M2 -> "S2"; 
    "S2" -> V2; 
    V2 -> "..."; 
    "..." -> "S_n"; 
    M_n -> "S_n"; 
    "S_n" -> f; 
    f -> "FINAL" 

    rankdir=LR; 
} 

回答

1

rank屬性允許約束相同subgraph的兩個(或更多)的節點到同一等級。有鑑於此:

digraph ER { 

rankdir=LR; 

node [shape=none]; "..."; 
node [shape=egg]; IV; V1; V2; 
node [shape=box]; f; 
{rank=same; "S1"; M1[shape=parallelogram];} 
{rank=same; "S2"; M2[shape=parallelogram];} 
{rank=same; "S_n"; M_n[shape=parallelogram];} 
node [shape=hexagon]; "FINAL"; 

    IV -> "S1"; 
    M1 -> "S1"; 
    "S1" -> V1; 
    V1 -> "S2"; 
    M2 -> "S2"; 
    "S2" -> V2; 
    V2 -> "..."; 
    "..." -> "S_n"; 
    M_n -> "S_n"; 
    "S_n" -> f; 
    f -> "FINAL" 

} 
+0

非常感謝它,它像一個魅力 – S12000