2011-09-28 42 views
45

我想創建一個圖中有兩個子圖的點。代碼如下:Graphviz子圖不可見

digraph G { 
     subgraph step1 { 
       style=filled; 
       node [label="Compiler"] step1_Compiler; 
       node [label="Maschine"] step1_Maschine; 
       color=lightgrey; 
     } 

     subgraph step2 { 
       style=filled; 
       color=lightgrey; 
       node [label="Interpretierer"] step2_Interpretierer; 
       node [label="Maschine"] step2_Maschine; 
       label="Virtuelle Maschine"; 
     } 

     "Programm (Java)" -> step1_Compiler; 
     step1_Compiler -> step1_Maschine; 
     step1_Maschine -> "Bytecode"; 
     "Bytecode" -> step2_Interpretierer; 
     step2_Interpretierer -> step2_Maschine; 
     step2_Maschine -> "Ergebnis"; 
} 

結果我得到如下所示:

Result of above code

我期望看到兩個子圖周圍的框。我在這裏錯過了什麼?

回答

93

你有集羣前綴的子圖名稱:

subgraph clusterstep1 { 

subgraph clusterstep2 { 

,以獲取其風格和標籤。

graphiz documentation, section "Subgraphs and Clusters"

爲子圖的第三個作用,直接涉及到圖形怎麼會 某些佈局引擎佈局。 如果子圖的名稱從集羣開始 ,則Graphviz將該子圖記錄爲特殊集羣 子圖。如果支持,佈局引擎將執行佈局,以便屬於該集羣的節點被繪製在一起,並且整個 圖形包含在邊界矩形內。注 ,對於好的和壞的,聚類子圖不是DOT 語言的一部分,但是僅僅是佈局引擎的某些 遵守的語法慣例。

+0

那麼子圖和子圖簇*都會在佈局算法下產生一個可視化分組嗎? – Chris

+0

非常感謝你。 – sjas