2017-05-03 69 views
0

這是我想產生一個點圖什麼:的Graphviz/DOT:如何有箭頭 「重定向」

graph

我有以下代碼:

\digraph 
[scale=0.7]{g1} 
{ 
    margin="0 0 0 0"; 
    rankdir="TB"; 
"X" [shape=invhouse]; 
" " [shape=house]; 
"100" [shape=cylinder]; 
"X" -> "100" 
"X" -> "+"; 
"100" -> "+" 
"+" -> " "; 
} 

我也具有以下代碼,其在某種意義上更接近但視覺上看起來不像我想要的:

digraph { 
     node[ shape = plaintext ]; 
     a [label="X", shape = invhouse] 
     b [label="+", shape = ellipse] 
     ab1 [label="dummy", style=invis, shape=point] 
     ab2 [label="dummy", style=invis, shape=point] 
     c [label="100", shape = cylinder] 
     d [label=" ", shape=house] 
     subgraph cluster_0 { 
     style=invis 
       a -> ab1 [arrowhead=none]; 
       ab1 -> c; 
       c -> ab2; 
       ab1 -> ab2 [arrowhead=none]; 
       ab2 -> b; 
       b -> d; 
     } 
} 

我該如何更改我的代碼?任何幫助將不勝感激。

回答

0

group屬性有助於使節點在行

digraph { 
    node[ shape = plaintext group=abd]; 
    a [label="X", shape = invhouse] 
    b [label="+", shape = ellipse] 
    ab1 [label="dummy", style=invis, shape=point] 
    ab2 [label="dummy", style=invis, shape=point] 
    c [label="100", shape = cylinder, group=c] 
    d [label=" ", shape=house] 
    subgraph cluster_0 { 
    style=invis 
      a -> ab1 [arrowhead=none]; 
      ab1 -> c; 
      c -> ab2; 
      ab1 -> ab2 [arrowhead=none]; 
      ab2 -> b; 
      b -> d; 
    } 
} 

straightened out

+0

這是輝煌的,謝謝! –