2012-10-25 2 views
4

dot -Tsvg을 사용하여 그래프를 만들었습니다.dot/graphviz : 2 노드를 나란히 배치하는 방법

digraph genealogy { 
    size = "7,7"; 
    node [fontsize = "10", shape = "box", style="filled", fillcolor="aquamarine"]; 
    p1 [ fillcolor="aquamarine", label="node" ]; 
    p2 [ fillcolor="aquamarine", label="node" ]; 
    p3 [ fillcolor="aquamarine", label="node" ]; 
    p4 [ fillcolor="aquamarine", label="node" ]; 
    p5 [ fillcolor="aquamarine", label="node" ]; 
    p6 [ fillcolor="aquamarine", label="node" ]; 
    p7 [ fillcolor="aquamarine", label="node" ]; 
    p8 [ fillcolor="aquamarine", label="node" ]; 
    p9 [ fillcolor="aquamarine", label="node" ]; 
    p11 [ fillcolor="aquamarine", label="node" ]; 
    p12 [ fillcolor="aquamarine", label="node" ]; 
    p13 [ fillcolor="aquamarine", label="node" ]; 
    p16 [ fillcolor="aquamarine", label="node" ]; 
    p17 [ fillcolor="aquamarine", label="node" ]; 
    b1 [ shape = "point", style="filled", fillcolor="white" ]; 
    p3 -> b1 [arrowhead = "none", color="red"]; 
    b2 [ shape = "point", style="filled", fillcolor="white" ]; 
    p2 -> b2 [arrowhead = "none", color="red"]; 
    p3 -> b2 [arrowhead = "none", color="red"]; 
    b3 [ shape = "point", style="filled", fillcolor="white" ]; 
    p4 -> b3 [arrowhead = "none", color="red"]; 
    p5 -> b3 [arrowhead = "none", color="red"]; 
    b4 [ shape = "point", style="filled", fillcolor="white" ]; 
    p6 -> b4 [arrowhead = "none", color="red"]; 
    p11 -> b4 [arrowhead = "none", color="red"]; 
    b2 -> p1 [arrowhead = "onormal", color="red"]; 
    b3 -> p2 [arrowhead = "onormal", color="red"]; 
    b3 -> p6 [arrowhead = "onormal", color="red"]; 
    b3 -> p7 [arrowhead = "onormal", color="red"]; 
    b4 -> p8 [arrowhead = "onormal", color="red"]; 
    b4 -> p9 [arrowhead = "onormal", color="red"]; 
    b1 -> p12 [arrowhead = "onormal", color="red"]; 
    b1 -> p13 [arrowhead = "onormal", color="red"]; 
    b1 -> p16 [arrowhead = "onormal", color="red"]; 
    p4 -> p5 [dir="none", arrowhead = "none", color="blue"]; 
    p7 -> p17 [dir="none", arrowhead = "none", color="blue"]; 
} 

이 결과 :

내가 만든 도트 언어 파일입니다

내가 나란히 할 수있는 파란색 선으로 연결된 노드를 강제로 싶습니다 측면 (수평)이며, 서로 아래 또는 다른 미친 위치에 있지 않습니다.

이것이 가능합니까?

의견을 보내 주셔서 감사합니다. :)

답변

4

순위 속성을 사용할 수 있습니다. rank = "same"또는 rank = "source"설정은 helpfui 일 수 있습니다. 그러면 두 노드가 같은 순위 또는 가장 낮은 순위에 배치됩니다. 여기 가능성 중 하나입니다

digraph genealogy { 
    size = "7,7"; 
    node [fontsize = "10", shape = "box", style="filled", fillcolor="aquamarine"]; 

    subgraph _1 { 
    rank="same"; 
    p4 [ fillcolor="aquamarine", label="node" ]; 
    p5 [ fillcolor="aquamarine", label="node" ]; 
    p4 -> p5 [dir="none", arrowhead = "none", color="blue"]; 
} 
    subgraph _2 { 
    rank="source"; 
    p7 [ fillcolor="aquamarine", label="node" ]; 
    p17 [ fillcolor="aquamarine", label="node" ]; 
    p7 -> p17 [dir="none", arrowhead = "none", color="blue"]; 
} 

p1 [ fillcolor="aquamarine", label="node" ]; 
p2 [ fillcolor="aquamarine", label="node" ]; 
p3 [ fillcolor="aquamarine", label="node" ]; 
p6 [ fillcolor="aquamarine", label="node" ]; 
p8 [ fillcolor="aquamarine", label="node" ]; 
p9 [ fillcolor="aquamarine", label="node" ]; 
p11 [ fillcolor="aquamarine", label="node" ]; 
p12 [ fillcolor="aquamarine", label="node" ]; 
p13 [ fillcolor="aquamarine", label="node" ]; 
p16 [ fillcolor="aquamarine", label="node" ]; 
b1 [ shape = "point", style="filled", fillcolor="white" ]; 
p3 -> b1 [arrowhead = "none", color="red"]; 
b2 [ shape = "point", style="filled", fillcolor="white" ]; 
p2 -> b2 [arrowhead = "none", color="red"]; 
p3 -> b2 [arrowhead = "none", color="red"]; 
b3 [ shape = "point", style="filled", fillcolor="white" ]; 
p4 -> b3 [arrowhead = "none", color="red"]; 
p5 -> b3 [arrowhead = "none", color="red"]; 
b4 [ shape = "point", style="filled", fillcolor="white" ]; 
p6 -> b4 [arrowhead = "none", color="red"]; 
p11 -> b4 [arrowhead = "none", color="red"]; 
b2 -> p1 [arrowhead = "onormal", color="red"]; 
b3 -> p2 [arrowhead = "onormal", color="red"]; 
b3 -> p6 [arrowhead = "onormal", color="red"]; 
b3 -> p7 [arrowhead = "onormal", color="red"]; 
b4 -> p8 [arrowhead = "onormal", color="red"]; 
b4 -> p9 [arrowhead = "onormal", color="red"]; 
b1 -> p12 [arrowhead = "onormal", color="red"]; 
b1 -> p13 [arrowhead = "onormal", color="red"]; 
b1 -> p16 [arrowhead = "onormal", color="red"]; 

} 

Output is here

+0

대단히 감사합니다! :)'rank = "same"'속성을 가진 부분 그래프는 내 문제를 해결합니다. – ryu

+0

도움이 될 수있어서 기쁩니다! –

관련 문제