2017-10-03 4 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

관련 문제