2017-08-07 8 views
0
digraph G{ 
    rankdir=LR; 
    size="12.34"; 
    node [shape="rectangle"] 
    apple -> "ball" 
    subgraph cluster_0 { 
      rankdir=LR; 
      node[style = filled]; 
      color = blue 
    subgraph cluster_4{ 
      rankdir=LR; 
      node[style=filled]; 
      fontsize=15; 
      l[fontcolor=red] e[fontcolor=red] i[fontcolor=red] 
      g[fontcolor=red] k[fontcolor=red] 
      color=orange 
      } 
    subgraph cluster_3 { 
      rankdir=LR; 
      node [style=filled]; 
      fontsize=15 
      "wq"[fontcolor=red,fontsize=12] ". . . . " "wqnn" 
      [fontcolor=red,fontsize=12]; 
      label = "zebra"; 
      color=orange 
      } 
    subgraph cluster_2 { 
      rankdir=LR; 
      node [style=filled]; 
      fontsize=15 
      struct3 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{d1}|{ a | b | c }}"]; 
      struct4 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{d2}|{ a | b | c }}"]; 
      struct5 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{d3}|{ a | b }}"]; 
      struct6 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{d4}|{ a }}"]; 
      ". . . . . ." 
      struct7 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{dn}|{a }}"]; 
      label = "tiger"; 
      color=orange 
      } 
    subgraph cluster_1{ 
      node[ style = filled]; 
      struct1 [shape=record, 
      rankdir=LR,fontsize=12,fontcolor=red, label="{{n}|{ x| y| 
      z }}"]; 
      ". . . . . ." 
      struct2 [shape=record, 
      rankdir=LR,fontsize=12,fontcolor=red, label="{{m}|{ x | y 
      | z }}"]; 
      label = "lion"; 
      fontsize=15 
      color = orange 
      } 
      edge[color="violet"] 
      "cat" -> "wq" 
      "cat" -> "struct3" 
      "cat" -> "struct1" 
      "cat" -> "l" 
     } 
     "ball" -> "cat"[label="abc"]; 
} 

私は初心者です(ドット言語とグラフビズ)。私はこのようなコードを書いています。私は水平線でd1 d2 d3 d4ボックスを必要とします。助けてくださいgraphviz(ドット言語)は、水平線でノードを取得できますか?

image.dot

どのようにそれらのボックスを取得するのは水平です。これのために私は何をすることができますか?これらのノードをどのように水平にすることができますか?前もって感謝します。

答えて

0

これは何か?私は左から右の順序を強制する目に見えないリンクを作った。 rankdirの設定と組み合わせると、左から右に移動します。私を助けるため

digraph G{ 
    rankdir=LR; 
    size="12.34"; 
    node [shape="rectangle"] 
compound=true; 


    subgraph cluster_0 { 
      rankdir=LR; 
      node[style = filled]; 
      color = blue 


    subgraph cluster_4{ 
      rankdir=LR; 
      node[style=filled]; 
      fontsize=15; 
      l[fontcolor=red] e[fontcolor=red] i[fontcolor=red] 
      g[fontcolor=red] k[fontcolor=red] 
      color=orange 

    l -> e -> i -> g -> k [style=invis]; 

      } 



    subgraph cluster_3 { 
      rankdir=LR; 
      node [style=filled]; 
      fontsize=15 
      "wq"[fontcolor=red,fontsize=12] ". . . . " "wqnn" 
      [fontcolor=red,fontsize=12]; 
      label = "zebra"; 
      color=orange 


    dummy3 [label = "" style=invis] 
    dummy4 [label = "" style=invis] 
    wqnn -> dummy3 -> dummy4 [style=invis] 
    wq -> ". . . . " -> "wqnn" [style=invis]; 
      } 


    subgraph cluster_2 { 
      rankdir=LR; 
      node [style=filled]; 
      fontsize=15 
      struct3 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{d1}|{ a | b | c }}"]; 
      struct4 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{d2}|{ a | b | c }}"]; 
      struct5 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{d3}|{ a | b }}"]; 
      struct6 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{d4}|{ a }}"]; 

    struct3 -> struct4 -> struct5 -> struct6 -> struct7 [style=invis]; 

      struct7 [shape=record,fontsize=12, fontcolor=red, label=" 
      {{dn}|{a }}"]; 
      label = "tiger"; 
      color=orange 
      } 

    subgraph cluster_1{ 
      node[ style = filled]; 
      struct1 [shape=record, 
      rankdir=LR,fontsize=12,fontcolor=red, label="{{n}|{ x| y| 
      z }}"]; 
      ". . . . . ." 
      struct2 [shape=record, 
      rankdir=LR,fontsize=12,fontcolor=red, label="{{m}|{ x | y 
      | z }}"]; 
      label = "lion"; 
      fontsize=15 
      color = orange 

    dummy1 [label = "" style=invis] 
    dummy2 [label = "" style=invis] 
    struct2 -> dummy1 -> dummy2 [style=invis] 
    struct1 -> ". . . . . ." -> struct2 [stle=invis]; 
      } 


      edge[color="violet"] 
      "cat" -> "wq" [lhead=cluster_3 ] 
      "cat" -> "struct3" [lhead=cluster_2 ] 
      "cat" -> "struct1" [lhead=cluster_1 ] 
      "cat" -> "l" [lhead=cluster_4 ] 

     } 

     "ball" -> "cat"[label="abc"]; 
     apple -> "ball" 

} 

enter image description here

+0

感謝。私が必要とするこの方法。また、シマウマ、ライオン(サブグラフクラスター)、最後のボックス(ノード)も。あなたは私が前進するのを助けてくれますか?ありがとうたくさん –

+0

そして矢印(エッジ)はボックスの外にあります(エッジは黄色のボックスに触れるでしょう)。これのために生のイメージを上に検討していただけますか?ありがとうございました。 –

+0

猫からの矢印は、各サブグラフクラスタ内の特定のノードに接続しています。代わりに、矢印は外側のボックス自体に接続する必要があります。 (私が投稿した画像を考慮してください)。ありがとう –

関連する問題