2016-10-26 15 views
0

나는 다음과 같은 그래픽을 만든 화살표 "("git pull "이라는 레이블이 붙어 있습니다.) 나는이 화살표를 이상적으로 먼저 약간 아래로, 그 다음 왼쪽으로, 그리고 위로 움직이고 싶습니다. 단순히 코드에 화살표를 추가graphviz를이 :</p> <p><a href="https://i.stack.imgur.com/czIF3.png" rel="nofollow"><img src="https://i.stack.imgur.com/czIF3.png" alt="enter image description here"></a></p> <p>내가 "원격 REPO"모든 방법에 "작업 복사본에서 다시 가리키는 추가 화살표를 추가하고 싶습니다 : 수평 정렬이 거꾸로 작동하지 것은

은 그래픽은 다음과 같이 찾고 끝 :

enter image description here

을 그리고 이것은 코드입니다 :

digraph G { 
    /* set direction of graph to be left-->right */ 
    rankdir="LR"; 

    /* make boxes instead of ellipses */ 
    node [shape=box]; 

    /* should enforce nodes to be horizontally aligned */ 
    /* is not working, though... */ 
    rank=same; 

    /* assign labels to nodes */ 
    wc [label="working copy"]; 
    id [label="index"]; 
    lr [label="local repo"]; 
    rr [label="remote repo"]; 

    wc -> id [label="git add"]; 
    id -> lr [label="git commit"]; 
    lr -> rr [label="git push"]; 

    rr -> wc [label="git pull"]; 
} 

질문 : 왜 수평 정렬이 깨졌고 이것을 고치는 방법?

후속 질문 : 화살표를 아래로 향하게하고 왼쪽으로 향하게하려면 어떻게합니까? (또는 보이지 않는/가짜 노드를 어떻게 든 사용하여이 작업을 수행하는 유일한 방법은 무엇입니까?)

답변

1

constraint=false 특성으로 문제가있는 가장자리를 수정할 수 있습니다. 그런 다음 아래 다이어그램을받습니다.

enter image description here

당신은 그래프도 splines=ortho 당신이 할 수있는 더 많은 각 가장자리를 선호하는 경우.

enter image description here

예를 들어 작업에 http://graphviz.it/#/mqNwRgzu을 확인하시기 바랍니다. 아래에 소스 코드를 붙여 넣었습니다.

digraph G { 
    /* set direction of graph to be left-->right */ 
    rankdir="LR"; 
    splines=ortho; 

    /* make boxes instead of ellipses */ 
    node [shape=box]; 

    /* should enforce nodes to be horizontally aligned */ 
    /* is not working, though... */ 
    rank=same; 

    /* assign labels to nodes */ 
    wc [label="working copy"]; 
    id [label="index"]; 
    lr [label="local repo"]; 
    rr [label="remote repo"]; 

    wc -> id [label="git add"]; 
    id -> lr [label="git commit"]; 
    lr -> rr [label="git push"]; 

    rr -> wc [label="git pull", constraint=false]; 
}