2014-10-14 11 views
2

graphviz로 디지털 회로 넷리스트를 표시하려고합니다. 내가 의지하고Graphviz에서 노드를 왼쪽 정렬하는 방법은 무엇입니까?

:

  • 기록 모양은 입/출력 포트를 나타냅니다.
  • rankdir = LR 오른쪽 정렬

다음 코드는 잘 작동에 왼쪽을 제안합니다. 그러나 레이아웃 중에는 일부 입력 (여기에서는 "i3")이 잘못 정렬 될 수 있습니다. i1과 i2와 마찬가지로 i3이 왼쪽 정렬로 나타납니다.

어떻게하면됩니까?

digraph G { 
    graph [rankdir = LR]; 
    node[shape=record]; 
    c1[ label="{ {<i1>i1|<i2>i2}| c1 | {<f>f} }"]; 
    c2[ label="{ {<i0>i0}| c2 | {<out_0>out_0} }"]; 
    c3[ label="{ {<i0>i0}| c3 | {<out_0>out_0} }"]; 
    c4[ label="{ {<i0>i0|<i1>i1}| c4 | {<out_0>out_0} }"]; 
    i1; i2; i3; f; i1 -> c2:i0[ label="w(1)"]; 
    i2 -> c3:i0[ label="w(2)"]; 
    i3 -> c4:i1[ label="w(4)"]; 
    c1:f -> c4:i0[label="w(3)"]; 
    c2:out_0 -> c1:i1[label="w(5)"]; 
    c3:out_0 -> c1:i2[label="w(6)"]; 
    c4:out_0 -> f[label="w(7)"]; 
} 

enter image description here

답변

1

단지 지정 I1, I2와 I3의 주 같은 순위가 :

digraph G { 
    graph [rankdir = LR]; 
    node[shape=record]; 
    c1[ label="{ {<i1>i1|<i2>i2}| c1 | {<f>f} }"]; 
    c2[ label="{ {<i0>i0}| c2 | {<out_0>out_0} }"]; 
    c3[ label="{ {<i0>i0}| c3 | {<out_0>out_0} }"]; 
    c4[ label="{ {<i0>i0|<i1>i1}| c4 | {<out_0>out_0} }"]; 
    i1; i2; i3; f; i1 -> c2:i0[ label="w(1)"]; 
    i2 -> c3:i0[ label="w(2)"]; 
    i3 -> c4:i1[ label="w(4)"]; 
    c1:f -> c4:i0[label="w(3)"]; 
    c2:out_0 -> c1:i1[label="w(5)"]; 
    c3:out_0 -> c1:i2[label="w(6)"]; 
    c4:out_0 -> f[label="w(7)"]; 

    {rank=same; i1; i2; i3} 
}