2013-03-19 1 views
0

나는 위키 미디어 공용에서처럼 수직으로 정렬 된 링크 목록을 그리는 싶습니다graphviz를 링크 목록 화살표 꼬리 기원

Credit: wikimedia commons

내 최선 지금까지입니다 :

digraph foo { 
     rankdir=LR; 
     node [shape=record]; 
     a [label="{ <data> 12 | <ref> }"] 
     b [label="{ <data> 99 | <ref> }"]; 
     c [label="{ <data> 37 | <ref> }"]; 
     d [shape=box]; 
     a:ref -> b:data [arrowhead=vee, arrowtail=dot, dir=both]; 
     b:ref -> c:data [arrowhead=vee, arrowtail=dot, dir=both]; 
     c:ref -> d  [arrowhead=vee, arrowtail=dot, dir=both]; 
} 

주는 :

enter image description here

레코드 내에서 시작하려면 arrowtail 점을 어떻게 설정하고 레코드를 X 노드로 나타나게 설정합니까?

행운이없는 tailclip=false을 사용해 보았습니다.

+1

대답의 일부는 다음을 참조하십시오. http://stackoverflow.com/questions/7020529/starting-an-edge-from-within-a-node – minopret

+0

시도한 'tailclip = false', 운이 없음 - 내 질문 업데이트 . –

+0

GraphViz보다는 TikZ를 사용하는 솔루션 (개인적으로 GraphViz를 좋아하지만!) : http://tex.stackexchange.com/questions/19286/how-should-i-draw-a-singly-double-linked-list – minopret

답변

1

당신은 tailclip=false 가장자리의 꼬리 끝의 나침반 포인트 표시 설정해야합니다 :

digraph foo { 
     rankdir=LR; 
     node [shape=record]; 
     edge [tailclip=false]; 
     a [label="{ <data> 12 | <ref> }"] 
     b [label="{ <data> 99 | <ref> }"]; 
     c [label="{ <data> 37 | <ref> }"]; 
     d [shape=box]; 
     a:ref:c -> b:data [arrowhead=vee, arrowtail=dot, dir=both]; 
     b:ref:c -> c:data [arrowhead=vee, arrowtail=dot, dir=both]; 
     c:ref:c -> d  [arrowhead=vee, arrowtail=dot, dir=both]; 
} 

graphviz output

불행하게도, 모양 마지막 노드에 대한 필요를 사용 가능한 default shapes에는 포함되지 않습니다. 포스트 스크립트 또는 비트 맵 이미지를 사용하여 custom shape을 추가하거나 SVG 출력을 사용하는 경우 SVG을 추가 할 수 있습니다.

+0

X가 표준 화살표 모양이 아니라는 점에 유의하십시오. 그 영리한 생각이 간다. 일부 작성자는 빈 노드의 상자에 십자가 대신 "NULL"이라는 단어를 사용합니다. 이 10 년 동안 PostScript 코드를 작성했다면 커스텀 노드 모양으로 충분할 EPS 파일을 만들 것입니다. – minopret

+0

필요한 출력에 따라 SVG로 멋지게 꾸밀 수 있습니다. 그렇지 않으면 상자에 거대한 X를 놓고 해당 노드의 글꼴과 크기를 변경하십시오 ... 해킹, 알겠습니다 : ( – marapet

+0

아하, 사용자 지정 노드 모양에 필요한 EPS 파일을 만드는 것이 쉽고 실용적인 방법이라고 생각합니다. Inkscape와 같은 벡터 그래픽 편집기를 사용합니다. – minopret