2017-09-10 122 views
1

我想用點語言繪製WBS。用點繪製工作分解結構(WBS)

我有幾個問題:

  • 更改排名方向(從上到下爲第一級,然後那種左至右爲其他級別)。
  • 一個邊緣鏈接兩個以上的節點

我想:

digraph A { 
    rankdir = TB; 
    graph [splines=ortho] 
    node [shape=box] 
    edge [dir=none] 

    node [label="1 Widget Mgmt. System"] 1 
    node [label="1.1 Initiation"] 1.1 
    node [label="1.1.1 Evaluation"] "1.1.1" 
    node [label="1.2 Planning"] 1.2 
    node [label="1.2.1"] "1.2.1" 
    node [label="1.2.1.1"] "1.2.1.1" 
    node [label="1.2.1.2"] "1.2.1.2" 
    node [label="1.2.2"] "1.2.2" 

    1 -> {1.1, 1.2} 
    1.2 -> {"1.2.1", "1.2.2"} 
    "1.2.1" -> {"1.2.1.1", "1.2.1.2"} 
} 

enter image description here

下面是結果我想: WBS example

+0

你表現爲預期的結果,畫面不包括1.2.1.x節點位置。 – slk

回答

0

,下圖顯示了使用集羣和隱藏節點進行對齊的想法。

digraph A { 
    newrank=true; 
    graph [splines=ortho]; 
    node [shape=box]; 
    edge [dir=none]; 
    style=invis;//Comment this line to see the ideas of using clusters 

    1 -> {11 12 13}; 

    subgraph cluster_11 { 
     11 -> {111 112 113 114}; 
     { 
      node [style=invis]; 
      edge [style=invis]; 
      subgraph cluster_C11_lvl_1 { 
       C11->111->112->113->114; 
      } 
      {rank=same 11 C11} 
     } 
    } 

    subgraph cluster_12 { 
     12 -> {121 122}; 
     121 -> {1211 1212}; 
     122 -> {1221 1222}; 
     { 
      node [style=invis]; 
      edge [style=invis]; 
      subgraph cluster_C12_lvl_1 { 
       C12->121->122; 
      } 
      subgraph cluster_C12_lvl_2 { 
       C121->1211->1212->C122->1221->1222; 
      } 
      {rank=same 12 C12} 
      {rank=same 121 C121} 
      {rank=same 122 C122} 
     } 
    } 

    subgraph cluster_13 { 
     13 -> {131 132 133} 
     { 
      node [style=invis]; 
      edge [style=invis]; 
      subgraph cluster_C13_lvl_1 { 
       C13->131->132->133; 
      } 
      {rank=same 13 C13} 
     } 
    } 
} 

它提供了以下結果:

enter image description here