2017-09-10 34 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