2017-10-03 5 views
2

私が持っている場合は、このようなgraphviz dotスクリプト:サブグラフクラスタの整列順序が逆にならないようにする方法は?

digraph g { 
node [style=rounded, shape=box] 

    subgraph cluster1 { 
     style="invis" 
     1 -> 2 -> 3 -> 4 -> 5 
    } 

    subgraph cluster2 { 
     style="invis" 
     6 -> 7 

     7 -> 8 -> 11 
     7 -> 9 -> 11 
     7 -> 10 -> 11 
    } 

    edge[constraint=false]; 
    splines="ortho" 
    5 -> 6 [weight=0] 
} 

私は(私が欲しいもの)は、このような出力が得られます。

enter image description here

しかし、もしいくつかの内のラベル最後のノードが長くなりすぎると、このように配置が逆になります。

digraph g { 
node [style=rounded, shape=box] 

8 [label="very long label"] 
9 [label="very long label"] 
10 [label="very long label"] 


    subgraph cluster1 { 
     style="invis" 
     1 -> 2 -> 3 -> 4 -> 5 
    } 

    subgraph cluster2 { 
     style="invis" 
     6 -> 7 

     7 -> 8 -> 11 
     7 -> 9 -> 11 
     7 -> 10 -> 11 
    } 

    edge[constraint=false]; 
    splines="ortho" 
    5 -> 6 [weight=0] 
} 

enter image description here

これを防止し、元の注文方法を強制するにはどうすればよいですか?

答えて

3

もう一方を定義した後、長いラベルを定義する必要があります。 graphvizは定義された順序でノードを描画します。

digraph g { 
node [style=rounded, shape=box] 

    subgraph cluster1 { 
     style="invis" 
     1 -> 2 -> 3 -> 4 -> 5 
    } 

    subgraph cluster2 { 
     style="invis" 
     6 -> 7 

     7 -> 8 -> 11 
     7 -> 9 -> 11 
     7 -> 10 -> 11 
    } 

    8 [label="very long label"] 
    9 [label="very long label"] 
    10 [label="very long label"] 

    edge[constraint=false]; 
    splines="ortho" 
    5 -> 6 [weight=0] 
} 

利回り

enter image description here

+0

おかげで多く、外観の所望の順序でノードを宣言することは、今偉大なアドバイスを操作する私のグラフのすべてがはるかに簡単になりました! – user5359531

関連する問題