2017-01-05 25 views
0

graphviz와 제공하는 circo 도구를 사용하여 그래프를 생성합니다.Graphviz 압축 그래프

생성 된 그래프는 멋진 모양이지만 노드 사이의 가장자리 길이가 필요 이상으로 길어 노드 텍스트가 작게 (출력 이미지 대비) 읽다. 내가 노드 내부의 텍스트를 쉽게 읽을 수 있도록 노드가 출력 이미지에 (상대적으로) 더 큰이 될 수있는 방법을

,

출력 이미지 :

enter image description here

소스 그래프 파일 :

digraph G { 
    FoundUrlToFollow [shape=box]; 
    "Fetch the URL" [shape=circle]; 
    FoundUrlToFollow -> "Fetch the URL"; 
    ResponseReceived [shape=box]; 
    "Fetch the URL" [shape=circle, label=<Fetch the URL>]; 
    "Fetch the URL" -> ResponseReceived; 
    ResponseError [shape=box]; 
    "Fetch the URL" [shape=circle, label=<Fetch the URL>]; 
    "Fetch the URL" -> ResponseError; 
    ResponseReceived [shape=box]; 
    "Log response" [shape=circle]; 
    ResponseReceived -> "Log response"; 
    ResponseReceived [shape=box]; 
    "Is the response OK?" [shape=circle]; 
    ResponseReceived -> "Is the response OK?"; 
    ResponseOk [shape=box]; 
    "Is the response OK?" [shape=circle, label=<Is the response<br/>OK?>]; 
    "Is the response OK?" -> ResponseOk; 
    ResponseOk [shape=box]; 
    "Is the response HTML?" [shape=circle]; 
    ResponseOk -> "Is the response HTML?"; 
    HtmlToParse [shape=box]; 
    "Is the response HTML?" [shape=circle, label=<Is the response<br/>HTML?>]; 
    "Is the response HTML?" -> HtmlToParse; 
    HtmlToParse [shape=box]; 
    "Parse the HTML to find links" [shape=circle]; 
    HtmlToParse -> "Parse the HTML to find links"; 
    FoundUrl [shape=box]; 
    "Parse the HTML to find links" [shape=circle, label=<Parse the HTML<br/>to find links>]; 
    "Parse the HTML to find links" -> FoundUrl; 
    FoundUrl [shape=box]; 
    "Should we follow this URL?" [shape=circle]; 
    FoundUrl -> "Should we follow this URL?"; 
    FoundUrlToSkip [shape=box]; 
    "Should we follow this URL?" [shape=circle, label=<Should we<br/>follow this<br/>URL?>]; 
    "Should we follow this URL?" -> FoundUrlToSkip; 
    FoundUrlToFollow [shape=box]; 
    "Should we follow this URL?" [shape=circle, label=<Should we<br/>follow this<br/>URL?>]; 
    "Should we follow this URL?" -> FoundUrlToFollow; 
    FoundUrlToSkip [shape=box]; 
    "Log skipped links" [shape=circle]; 
    FoundUrlToSkip -> "Log skipped links"; 
    graph [label="Switches are circles. Events are boxes.", fontsize="12", overlap=scale]; 
    edge [splines=curved]; 
} 

명령 :

circo -Tpng -ograph_so.png graph.dot 

답변

1

내가 그래프로 mindist (이하 1 이상)을 추가 할 것입니다 :

graph [..., overlap=scale, mindist=.6]; 

[편집]

어쩌면 렌더러 버전이 차이합니다 여기에 내 컴퓨터

에 결과가입니다

enter image description here

+0

그다지 큰 차이가없는 것 같습니다. - https://i.stack.imgur.com/gpOUX.png – Danack

+0

예, 최적이 아닙니다. 하지만 내 편집을 참조하십시오 ... – CapelliC

+0

한가지 다른 점은 libexpat에서 컴파일되지 않았기 때문에 HTML이 한 줄에 렌더링된다는 것입니다. 글꼴 크기와 결합하면 위치 지정을 크게 변경하는 것처럼 보입니다. – Danack

1

-Gsize (인치 단위) 및 -Gdpi 다양한 시도하십시오. 두 가지를 함께 변경하면 픽셀 크기가 같지만 노드 사이의 간격이 노드 자체의 크기에 비례하는 다른 출력을 얻게됩니다. -Gnodesep-Nfontsize 또한 조정할 때 유용 할 수 있습니다. Graphviz의 PNG 렌더러를 사용하는 대신 EPS 또는 PDF 또는 SVG로 렌더링 한 다음 PNG로 변환하여 더 나은 행운을 누릴 수도 있습니다. Graphviz의 만족스러운 결과물을 얻는 것은 제 경험상 매우 정확하지 않은 과학입니다.