我正在尝试用graphviz显示数字电路网表。
我诉诸:
以下代码正常。但是,在布局期间,某些输入(此处为" i3")可能未对齐:我希望i3左对齐,如i1和i2。
我该怎么做?
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)"];
}
答案 0 :(得分: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}
}