3

私はこのようなものを生成したい - エッジの角度ではなく、ノードの位置合わせが重要です:

+--------------+
|              |
+--------------+
   |        |
   V        V
+-----+  +-----+  <--- alignment at top
|     |  |     |
|     |->|     |
|     |  |     |
+-----+  |     |
   |     |     |
   V     |     |
+-----+  |     |
|     |  |     |
|     |->|     |
|     |  |     |
+-----+  +-----+  <--- alignment at bottom
   |        |
   V        V
+--------------+
|              |
+--------------+

私が思いついた最善の方法は、2 つの左側のノードを白い (=> 非表示) 境界線を持つクラスター サブグラフに貼り付け、エッジの 1 つの重みを 0 に設定することです。しかし、それはまだ完全ではありません。 :

digraph G {

    // scale things down for example
    size="5,5" 
    rankdir=TD
    ranksep=1
    nodesep=1

    node [shape=box]

    node [width=5 height=2]
    top

    subgraph cluster_left
    {
        color=white
        node [width=2 height=2]
        left1
        left2
    }

    node [width=2 height=5]
    right

    node [width=5 height=2]
    bottom

    top->left1
    top->right

    left1->left2
    left1->right
    left2->right [weight=0]

    left2->bottom
    right->bottom
}

これは次のようになります-調整が不十分です:

私が欲しいものを手に入れる方法についてのアイデアはありますか?

4

1 に答える 1

4

私はneatoとこのスクリプトでそれをやった:

digraph G {
  layout="neato"
  // scale things down for example
  size="5,5" 
  rankdir=TD
  ranksep=1
  nodesep=1

  node [shape=box]

  top[pos="5,10!", width=5, height=2]

  left1[pos="3.5,7!", width=2, height=2]
  left2[pos="3.5,4!", width=2, height=2]

  right[pos="6.5,5.5!", width=2, height=5]

  bottom[pos="5,1!", width=5, height=2]

  top->left1
  top->right

  left1->left2
  left1->right
  left2->right

  left2->bottom
  right->bottom
}

結果は次のとおりです。

代替テキスト

于 2010-11-14T19:40:09.267 に答える