2017-04-12 2 views
0

DOT 언어를 사용하여 R에 다이어그램을 만듭니다. 나는 이상한 결과를 얻었으므로 2 개의 노드 (노드 8과 노드 c4)의 위치를 ​​교환하는 방법에 관심이 있습니까?GraphViz 다이어그램 (DOT)에서 두 노드의 위치를 ​​바꾸기

코드 :

digraph DAG { 
    # Initialization of node attributes 
    node [shape = box, color = blue]; 2; 3; 4; 

    # Revision to node attributes 
    { node [shape = box,style = filled,fillcolor = yellow]; 8} 

    # Revision to node attributes 
    { node [shape = diamond, color = "red"]; c1; c2; c3; c4} 

    { rank=same; c1; c2; c3} 
    { rank=same; 8; c4} 

    # Initialization of edge attributes 
    edge [color = green, rel = yields] 

    # Edge statements 
    2->c1 [headport = w]; 
    c1->c2->c3 
    c2->c1 [tailport = n, headport = n]; 

    8->c3 [tailport = n, headport = s]; 
    c3->3 [tailport = e, headport = n]; 
    c3->c2 [tailport = n, headport = n]; 

    3->c4 [tailport = s, headport = n]; 
    c4->4 [tailport = s, headport = n]; 
    c4->8 [tailport = w, headport = e]; 
} 

(잘못된) 결과는 다음과 같습니다

enter image description here

답변

1

"잘못된 방법"가장자리 주셔서 수도

  • 스왑 노드와 사용 속성 dir = back '힘'을 뒤바다.
  • 사용 속성 constraint = none 당신이 중 하나를

    c4->8 [tailport = w, headport = e, constraint = none]; 
    

    또는

    8->c4 [tailport = e, headport = w, dir = back]; 
    
    을하여

    8->c4 [tailport = e, headport = w, dir = back]; 
    

    을 대체 귀하의 경우 그 '힘'

를 비활성화

관련 문제