GraphViz 点防止等级重叠
GraphViz Dot Prevent Ranks From Overlapping
我正在使用 graphviz 在我正在做的编译器项目中可视化 AST 树,但一个大问题是树可能变得非常大,一些节点有很多 child仁。
这导致发生的是一些 parent 节点将与其 parent 严重分离,因为它们的 children 迫使它们这样做。
看起来像这样:
我的问题是,是否可以让所有只有一个 child 的节点直接位于其下方节点的上方?因此,“decl f”节点将位于“assignment”节点的正上方,而该赋值节点位于“additive”节点的正上方。
我尝试在“decl f”和“additive”节点之间使用不可见的边缘和强大的权重来做到这一点,但这最终会抵消“assignment”节点,因此它不会与看不见的边缘。
代码是自动生成的,但我还是把输出放在这里。此输出适用于此图表:
digraph "ast tree" {
graph [bb="0,0,1767.5,377",
bgcolor=grey12,
concentrate=true,
splines=true
];
node [color=1,
colorscheme=rdylbu11,
fontcolor=white,
height=0,
label="\N",
margins=0.08,
shape=box,
width=0
];
edge [arrowhead=none,
color=white,
colorscheme=rdylbu11,
constraint=true,
penwidth=0.5
];
1 [height=0.31944,
label=program,
pos="270,365.5",
width=0.88889];
2 [height=0.31944,
label=function,
pos="230,306.5",
width=0.86111];
1 -> 2 [color=1,
pos="262.48,353.78 255.32,343.59 244.63,328.35 237.49,318.17"];
10 [color=5,
height=0.31944,
label=function,
pos="396,306.5",
width=0.86111];
1 -> 10 [color=5,
pos="293.4,353.91 316.04,343.67 350.13,328.25 372.72,318.03"];
3 [height=0.31944,
label=scope,
pos="135,247.5",
width=0.69444];
2 -> 3 [color=1,
pos="212.13,294.78 195.15,284.59 169.75,269.35 152.79,259.17"];
4 [height=0.31944,
label=scope,
pos="39,188.5",
width=0.69444];
3 -> 4 [color=1,
pos="116.94,235.78 99.78,225.59 74.112,210.35 56.976,200.17"];
8 [color=3,
height=0.31944,
label="return statement",
pos="135,188.5",
width=1.4583];
3 -> 8 [color=3,
pos="135,235.78 135,225.59 135,210.35 135,200.17"];
5 [height=0.31944,
label="decl a",
pos="39,129.5",
width=0.69444];
4 -> 5 [color=1,
pos="39,176.78 39,166.59 39,151.35 39,141.17"];
6 [height=0.31944,
label=assignment,
pos="39,70.5",
width=1.0833];
5 -> 6 [color=1,
pos="39,117.78 39,107.59 39,92.348 39,82.173"];
7 [height=0.31944,
label="literal 0",
pos="39,11.5",
width=0.77778];
6 -> 7 [color=1,
pos="39,58.779 39,48.588 39,33.348 39,23.173"];
9 [color=3,
height=0.31944,
label="literal 0",
pos="122,129.5",
width=0.77778];
8 -> 9 [color=3,
pos="132.55,176.78 130.23,166.59 126.75,151.35 124.43,141.17"];
11 [color=5,
height=0.31944,
label=scope,
pos="445,247.5",
width=0.69444];
10 -> 11 [color=5,
pos="405.22,294.78 413.98,284.59 427.08,269.35 435.82,259.17"];
12 [color=5,
height=0.31944,
label="decl a",
pos="253,188.5",
width=0.69444];
11 -> 12 [color=5,
pos="419.9,239.05 383.1,228.12 314.91,207.88 278.11,196.95"];
15 [color=7,
height=0.31944,
label="decl b",
pos="331,188.5",
width=0.70833];
11 -> 15 [color=7,
pos="423.82,235.91 403.35,225.67 372.5,210.25 352.06,200.03"];
18 [color=9,
height=0.31944,
label="decl c",
pos="404,188.5",
width=0.69444];
11 -> 18 [color=9,
pos="437.29,235.78 429.96,225.59 419,210.35 411.68,200.17"];
24 [color=4,
height=0.31944,
label="decl d",
pos="486,188.5",
width=0.70833];
11 -> 24 [color=4,
pos="452.71,235.78 460.04,225.59 471,210.35 478.32,200.17"];
32 [color=3,
height=0.31944,
label="decl e",
pos="575,188.5",
width=0.69444];
11 -> 32 [color=3,
pos="469.15,235.91 492.5,225.67 527.68,210.25 550.98,200.03"];
42 [color=6,
height=0.31944,
label="decl f",
pos="662,188.5",
width=0.66667];
11 -> 42 [color=6,
pos="470.32,239.85 512.47,228.78 596.47,206.71 637.84,195.85"];
54 [color=2,
height=0.31944,
label="return statement",
pos="767,188.5",
width=1.4583];
11 -> 54 [color=2,
pos="470.27,242.03 522.68,232.75 644.17,211.24 714.36,198.82"];
13 [color=5,
height=0.31944,
label=assignment,
pos="207,129.5",
width=1.0833];
12 -> 13 [color=5,
pos="244.35,176.78 236.12,166.59 223.82,151.35 215.61,141.17"];
14 [color=5,
height=0.31944,
label="literal 0",
pos="194,70.5",
width=0.77778];
13 -> 14 [color=5,
pos="204.55,117.78 202.23,107.59 198.75,92.348 196.43,82.173"];
16 [color=7,
height=0.31944,
label=assignment,
pos="303,129.5",
width=1.0833];
15 -> 16 [color=7,
pos="325.73,176.78 320.73,166.59 313.24,151.35 308.24,141.17"];
17 [color=7,
height=0.31944,
label="idRHS a",
pos="273,70.5",
width=0.90278];
16 -> 17 [color=7,
pos="297.36,117.78 291.99,107.59 283.97,92.348 278.62,82.173"];
19 [color=9,
height=0.31944,
label=assignment,
pos="399,129.5",
width=1.0833];
18 -> 19 [color=9,
pos="403.06,176.78 402.17,166.59 400.83,151.35 399.94,141.17"];
20 [color=9,
height=0.31944,
label=additive,
pos="354,70.5",
width=0.83333];
19 -> 20 [color=9,
pos="390.54,117.78 382.49,107.59 370.46,92.348 362.43,82.173"];
21 [color=9,
height=0.31944,
label="idRHS a",
pos="214,11.5",
width=0.90278];
20 -> 21 [color=9,
pos="328,58.912 302.85,48.674 264.96,33.25 239.87,23.031"];
22 [color=11,
height=0.31944,
label="+",
pos="277,11.5",
width=0.34722];
20 -> 22 [color=11,
pos="339.52,58.779 325.23,48.201 303.59,32.183 289.88,22.037"];
23 [color=2,
height=0.31944,
label="idRHS b",
pos="341,11.5",
width=0.91667];
20 -> 23 [color=2,
pos="351.55,58.779 349.23,48.588 345.75,33.348 343.43,23.173"];
25 [color=4,
height=0.31944,
label=assignment,
pos="495,129.5",
width=1.0833];
24 -> 25 [color=4,
pos="487.69,176.78 489.3,166.59 491.71,151.35 493.31,141.17"];
26 [color=4,
height=0.31944,
label=additive,
pos="520,70.5",
width=0.83333];
25 -> 26 [color=4,
pos="499.7,117.78 504.17,107.59 510.86,92.348 515.32,82.173"];
27 [color=4,
height=0.31944,
label="idRHS a",
pos="425,11.5",
width=0.90278];
26 -> 27 [color=4,
pos="502.13,58.779 485.15,48.588 459.75,33.348 442.79,23.173"];
28 [color=6,
height=0.31944,
label="+",
pos="488,11.5",
width=0.34722];
26 -> 28 [color=6,
pos="513.98,58.779 508.26,48.588 499.7,33.348 493.99,23.173"];
29 [color=8,
height=0.31944,
label="idRHS b",
pos="552,11.5",
width=0.91667];
26 -> 29 [color=8,
pos="526.02,58.779 531.74,48.588 540.3,33.348 546.01,23.173"];
30 [color=10,
height=0.31944,
label="+",
pos="616,11.5",
width=0.34722];
26 -> 30 [color=10,
pos="538.06,58.779 557.07,47.492 586.51,30.01 603.24,20.077"];
31 [height=0.31944,
label="idRHS c",
pos="679,11.5",
width=0.90278];
26 -> 31 [color=1,
pos="549.53,58.912 578.09,48.674 621.12,33.25 649.62,23.031"];
33 [color=3,
height=0.31944,
label=assignment,
pos="591,129.5",
width=1.0833];
32 -> 33 [color=3,
pos="578.01,176.78 580.87,166.59 585.15,151.35 588,141.17"];
34 [color=3,
height=0.31944,
label=additive,
pos="921,70.5",
width=0.83333];
33 -> 34 [color=3,
pos="630.26,119.74 633.21,119.13 636.15,118.55 639,118 730.37,100.48 839.18,83.682 890.86,75.944"];
35 [color=3,
height=0.31944,
label="idRHS a",
pos="762,11.5",
width=0.90278];
34 -> 35 [color=3,
pos="891.47,58.912 862.91,48.674 819.88,33.25 791.38,23.031"];
36 [color=5,
height=0.31944,
label="+",
pos="825,11.5",
width=0.34722];
34 -> 36 [color=5,
pos="902.94,58.779 883.93,47.492 854.49,30.01 837.76,20.077"];
37 [color=7,
height=0.31944,
label="idRHS b",
pos="889,11.5",
width=0.91667];
34 -> 37 [color=7,
pos="914.98,58.779 909.26,48.588 900.7,33.348 894.99,23.173"];
38 [color=9,
height=0.31944,
label="+",
pos="953,11.5",
width=0.34722];
34 -> 38 [color=9,
pos="927.02,58.779 932.74,48.588 941.3,33.348 947.01,23.173"];
39 [color=11,
height=0.31944,
label="idRHS c",
pos="1016,11.5",
width=0.90278];
34 -> 39 [color=11,
pos="938.87,58.779 955.85,48.588 981.25,33.348 998.21,23.173"];
40 [color=2,
height=0.31944,
label="+",
pos="1079,11.5",
width=0.34722];
34 -> 40 [color=2,
pos="951.1,60.584 979.15,51.97 1022,38.045 1058,23 1060.7,21.869 1063.6,20.544 1066.2,19.223"];
41 [color=4,
height=0.31944,
label="idRHS d",
pos="1143,11.5",
width=0.91667];
34 -> 41 [color=4,
pos="951.4,61.694 992.85,51.053 1066.8,32.061 1109.7,21.048"];
43 [color=6,
height=0.31944,
label=assignment,
pos="687,129.5",
width=1.0833];
42 -> 43 [color=6,
pos="666.7,176.78 671.17,166.59 677.86,151.35 682.32,141.17"];
44 [color=6,
height=0.31944,
label=additive,
pos="1449,70.5",
width=0.83333];
43 -> 44 [color=6,
pos="726.21,119.42 729.17,118.89 732.13,118.41 735,118 998.22,80.853 1320.3,73.317 1418.9,71.845"];
45 [color=6,
height=0.31944,
label="idRHS a",
pos="1227,11.5",
width=0.90278];
44 -> 45 [color=6,
pos="1418.6,61.694 1376.9,50.992 1302.3,31.843 1259.6,20.859"];
46 [color=8,
height=0.31944,
label="+",
pos="1290,11.5",
width=0.34722];
44 -> 46 [color=8,
pos="1419,60.43 1391,51.709 1348.2,37.714 1312,23 1309,21.788 1305.9,20.371 1302.9,18.976"];
47 [color=10,
height=0.31944,
label="idRHS b",
pos="1354,11.5",
width=0.91667];
44 -> 47 [color=10,
pos="1431.1,58.779 1414.1,48.588 1388.7,33.348 1371.8,23.173"];
48 [height=0.31944,
label="+",
pos="1418,11.5",
width=0.34722];
44 -> 48 [color=1,
pos="1443.2,58.779 1437.6,48.588 1429.3,33.348 1423.8,23.173"];
49 [color=3,
height=0.31944,
label="idRHS c",
pos="1481,11.5",
width=0.90278];
44 -> 49 [color=3,
pos="1455,58.779 1460.7,48.588 1469.3,33.348 1475,23.173"];
50 [color=5,
height=0.31944,
label="+",
pos="1544,11.5",
width=0.34722];
44 -> 50 [color=5,
pos="1466.9,58.779 1485.7,47.492 1514.8,30.01 1531.4,20.077"];
51 [color=7,
height=0.31944,
label="idRHS d",
pos="1608,11.5",
width=0.91667];
44 -> 51 [color=7,
pos="1478.5,58.912 1507.1,48.674 1550.1,33.25 1578.6,23.031"];
52 [color=9,
height=0.31944,
label="+",
pos="1672,11.5",
width=0.34722];
44 -> 52 [color=9,
pos="1479.2,64.634 1519,57.739 1591,43.627 1650,23 1653,21.939 1656.2,20.582 1659.2,19.199"];
53 [color=11,
height=0.31944,
label="idRHS e",
pos="1735,11.5",
width=0.90278];
44 -> 53 [color=11,
pos="1479.3,64.384 1525.7,56.405 1617.1,40.129 1694,23 1696.7,22.393 1699.5,21.735 1702.4,21.054"];
55 [color=2,
height=0.31944,
label="literal 0",
pos="772,129.5",
width=0.77778];
54 -> 55 [color=2,
pos="767.94,176.78 768.83,166.59 770.17,151.35 771.06,141.17"];
}
(您还可以查看 circo & twopi 引擎)
让节点垂直排列的技巧是为这些节点集的每一个分配一个唯一的 group 属性 (https://graphviz.org/docs/attrs/group/)。像这样:
digraph "ast tree" {
graph [bb="0,0,1767.5,377",
bgcolor=grey12,
concentrate=true,
splines=true
];
node [color=1,
colorscheme=rdylbu11,
fontcolor=white,
height=0,
label="\N",
margins=0.08,
shape=box,
width=0
];
edge [arrowhead=none,
color=white,
colorscheme=rdylbu11,
constraint=true,
penwidth=0.5
];
1 [height=0.31944,
label=program,
pos="270,365.5",
width=0.88889];
2 [height=0.31944,
label=function,
pos="230,306.5",
width=0.86111];
1 -> 2 [color=1,
pos="262.48,353.78 255.32,343.59 244.63,328.35 237.49,318.17"];
10 [color=5,
height=0.31944,
label=function,
pos="396,306.5",
width=0.86111];
1 -> 10 [color=5,
pos="293.4,353.91 316.04,343.67 350.13,328.25 372.72,318.03"];
3 [height=0.31944,
label=scope,
pos="135,247.5",
width=0.69444];
2 -> 3 [color=1,
pos="212.13,294.78 195.15,284.59 169.75,269.35 152.79,259.17"];
4 [height=0.31944,
label=scope,
pos="39,188.5",
width=0.69444];
3 -> 4 [color=1,
pos="116.94,235.78 99.78,225.59 74.112,210.35 56.976,200.17"];
8 [color=3,
height=0.31944,
label="return statement",
pos="135,188.5",
width=1.4583];
3 -> 8 [color=3,
pos="135,235.78 135,225.59 135,210.35 135,200.17"];
5 [height=0.31944,
label="decl a",
pos="39,129.5",
width=0.69444];
4 -> 5 [color=1,
pos="39,176.78 39,166.59 39,151.35 39,141.17"];
6 [height=0.31944,
label=assignment,
pos="39,70.5",
width=1.0833];
5 -> 6 [color=1,
pos="39,117.78 39,107.59 39,92.348 39,82.173"];
7 [height=0.31944,
label="literal 0",
pos="39,11.5",
width=0.77778];
6 -> 7 [color=1,
pos="39,58.779 39,48.588 39,33.348 39,23.173"];
9 [color=3,
height=0.31944,
label="literal 0",
pos="122,129.5",
width=0.77778];
8 -> 9 [color=3,
pos="132.55,176.78 130.23,166.59 126.75,151.35 124.43,141.17"];
11 [color=5,
height=0.31944,
label=scope,
pos="445,247.5",
width=0.69444];
10 -> 11 [color=5,
pos="405.22,294.78 413.98,284.59 427.08,269.35 435.82,259.17"];
12 [color=5,
height=0.31944,
label="decl a",
pos="253,188.5",
width=0.69444];
11 -> 12 [color=5,
pos="419.9,239.05 383.1,228.12 314.91,207.88 278.11,196.95"];
15 [color=7,
height=0.31944,
label="decl b",
pos="331,188.5",
width=0.70833];
11 -> 15 [color=7,
pos="423.82,235.91 403.35,225.67 372.5,210.25 352.06,200.03"];
18 [color=9,
height=0.31944,
label="decl c",
pos="404,188.5",
width=0.69444];
11 -> 18 [color=9,
pos="437.29,235.78 429.96,225.59 419,210.35 411.68,200.17"];
24 [color=4,
height=0.31944,
label="decl d",
pos="486,188.5",
width=0.70833];
11 -> 24 [color=4,
pos="452.71,235.78 460.04,225.59 471,210.35 478.32,200.17"];
32 [color=3,
height=0.31944,
label="decl e",
pos="575,188.5",
width=0.69444];
11 -> 32 [color=3,
pos="469.15,235.91 492.5,225.67 527.68,210.25 550.98,200.03"];
42 [color=6,
height=0.31944,
label="decl f",
pos="662,188.5",
width=0.66667];
11 -> 42 [color=6,
pos="470.32,239.85 512.47,228.78 596.47,206.71 637.84,195.85"];
54 [color=2,
height=0.31944,
label="return statement",
pos="767,188.5",
width=1.4583];
11 -> 54 [color=2,
pos="470.27,242.03 522.68,232.75 644.17,211.24 714.36,198.82"];
13 [color=5,
height=0.31944,
label=assignment,
pos="207,129.5",
width=1.0833];
12 -> 13 [color=5,
pos="244.35,176.78 236.12,166.59 223.82,151.35 215.61,141.17"];
14 [color=5,
height=0.31944,
label="literal 0",
pos="194,70.5",
width=0.77778];
13 -> 14 [color=5,
pos="204.55,117.78 202.23,107.59 198.75,92.348 196.43,82.173"];
16 [color=7,
height=0.31944,
label=assignment,
pos="303,129.5",
width=1.0833];
15 -> 16 [color=7,
pos="325.73,176.78 320.73,166.59 313.24,151.35 308.24,141.17"];
17 [color=7,
height=0.31944,
label="idRHS a",
pos="273,70.5",
width=0.90278];
16 -> 17 [color=7,
pos="297.36,117.78 291.99,107.59 283.97,92.348 278.62,82.173"];
19 [color=9,
height=0.31944,
label=assignment,
pos="399,129.5",
width=1.0833];
18 -> 19 [color=9,
pos="403.06,176.78 402.17,166.59 400.83,151.35 399.94,141.17"];
20 [color=9,
height=0.31944,
label=additive,
pos="354,70.5",
width=0.83333];
19 -> 20 [color=9,
pos="390.54,117.78 382.49,107.59 370.46,92.348 362.43,82.173"];
21 [color=9,
height=0.31944,
label="idRHS a",
pos="214,11.5",
width=0.90278];
20 -> 21 [color=9,
pos="328,58.912 302.85,48.674 264.96,33.25 239.87,23.031"];
22 [color=11,
height=0.31944,
label="+",
pos="277,11.5",
width=0.34722];
20 -> 22 [color=11,
pos="339.52,58.779 325.23,48.201 303.59,32.183 289.88,22.037"];
23 [color=2,
height=0.31944,
label="idRHS b",
pos="341,11.5",
width=0.91667];
20 -> 23 [color=2,
pos="351.55,58.779 349.23,48.588 345.75,33.348 343.43,23.173"];
25 [color=4,
height=0.31944,
label=assignment,
pos="495,129.5",
width=1.0833];
24 -> 25 [color=4,
pos="487.69,176.78 489.3,166.59 491.71,151.35 493.31,141.17"];
26 [color=4,
height=0.31944,
label=additive,
pos="520,70.5",
width=0.83333];
25 -> 26 [color=4,
pos="499.7,117.78 504.17,107.59 510.86,92.348 515.32,82.173"];
27 [color=4,
height=0.31944,
label="idRHS a",
pos="425,11.5",
width=0.90278];
26 -> 27 [color=4,
pos="502.13,58.779 485.15,48.588 459.75,33.348 442.79,23.173"];
28 [color=6,
height=0.31944,
label="+",
pos="488,11.5",
width=0.34722];
26 -> 28 [color=6,
pos="513.98,58.779 508.26,48.588 499.7,33.348 493.99,23.173"];
29 [color=8,
height=0.31944,
label="idRHS b",
pos="552,11.5",
width=0.91667];
26 -> 29 [color=8,
pos="526.02,58.779 531.74,48.588 540.3,33.348 546.01,23.173"];
30 [color=10,
height=0.31944,
label="+",
pos="616,11.5",
width=0.34722];
26 -> 30 [color=10,
pos="538.06,58.779 557.07,47.492 586.51,30.01 603.24,20.077"];
31 [height=0.31944,
label="idRHS c",
pos="679,11.5",
width=0.90278];
26 -> 31 [color=1,
pos="549.53,58.912 578.09,48.674 621.12,33.25 649.62,23.031"];
33 [color=3,
height=0.31944,
label=assignment,
pos="591,129.5",
width=1.0833];
32 -> 33 [color=3,
pos="578.01,176.78 580.87,166.59 585.15,151.35 588,141.17"];
34 [color=3,
height=0.31944,
label=additive,
pos="921,70.5",
width=0.83333];
33 -> 34 [color=3,
pos="630.26,119.74 633.21,119.13 636.15,118.55 639,118 730.37,100.48 839.18,83.682 890.86,75.944"];
35 [color=3,
height=0.31944,
label="idRHS a",
pos="762,11.5",
width=0.90278];
34 -> 35 [color=3,
pos="891.47,58.912 862.91,48.674 819.88,33.25 791.38,23.031"];
36 [color=5,
height=0.31944,
label="+",
pos="825,11.5",
width=0.34722];
34 -> 36 [color=5,
pos="902.94,58.779 883.93,47.492 854.49,30.01 837.76,20.077"];
37 [color=7,
height=0.31944,
label="idRHS b",
pos="889,11.5",
width=0.91667];
34 -> 37 [color=7,
pos="914.98,58.779 909.26,48.588 900.7,33.348 894.99,23.173"];
38 [color=9,
height=0.31944,
label="+",
pos="953,11.5",
width=0.34722];
34 -> 38 [color=9,
pos="927.02,58.779 932.74,48.588 941.3,33.348 947.01,23.173"];
39 [color=11,
height=0.31944,
label="idRHS c",
pos="1016,11.5",
width=0.90278];
34 -> 39 [color=11,
pos="938.87,58.779 955.85,48.588 981.25,33.348 998.21,23.173"];
40 [color=2,
height=0.31944,
label="+",
pos="1079,11.5",
width=0.34722];
34 -> 40 [color=2,
pos="951.1,60.584 979.15,51.97 1022,38.045 1058,23 1060.7,21.869 1063.6,20.544 1066.2,19.223"];
41 [color=4,
height=0.31944,
label="idRHS d",
pos="1143,11.5",
width=0.91667];
34 -> 41 [color=4,
pos="951.4,61.694 992.85,51.053 1066.8,32.061 1109.7,21.048"];
43 [color=6,
height=0.31944,
label=assignment,
pos="687,129.5",
width=1.0833];
42 -> 43 [color=6,
pos="666.7,176.78 671.17,166.59 677.86,151.35 682.32,141.17"];
44 [color=6,
height=0.31944,
label=additive,
pos="1449,70.5",
width=0.83333];
43 -> 44 [color=6,
pos="726.21,119.42 729.17,118.89 732.13,118.41 735,118 998.22,80.853 1320.3,73.317 1418.9,71.845"];
45 [color=6,
height=0.31944,
label="idRHS a",
pos="1227,11.5",
width=0.90278];
44 -> 45 [color=6,
pos="1418.6,61.694 1376.9,50.992 1302.3,31.843 1259.6,20.859"];
46 [color=8,
height=0.31944,
label="+",
pos="1290,11.5",
width=0.34722];
44 -> 46 [color=8,
pos="1419,60.43 1391,51.709 1348.2,37.714 1312,23 1309,21.788 1305.9,20.371 1302.9,18.976"];
47 [color=10,
height=0.31944,
label="idRHS b",
pos="1354,11.5",
width=0.91667];
44 -> 47 [color=10,
pos="1431.1,58.779 1414.1,48.588 1388.7,33.348 1371.8,23.173"];
48 [height=0.31944,
label="+",
pos="1418,11.5",
width=0.34722];
44 -> 48 [color=1,
pos="1443.2,58.779 1437.6,48.588 1429.3,33.348 1423.8,23.173"];
49 [color=3,
height=0.31944,
label="idRHS c",
pos="1481,11.5",
width=0.90278];
44 -> 49 [color=3,
pos="1455,58.779 1460.7,48.588 1469.3,33.348 1475,23.173"];
50 [color=5,
height=0.31944,
label="+",
pos="1544,11.5",
width=0.34722];
44 -> 50 [color=5,
pos="1466.9,58.779 1485.7,47.492 1514.8,30.01 1531.4,20.077"];
51 [color=7,
height=0.31944,
label="idRHS d",
pos="1608,11.5",
width=0.91667];
44 -> 51 [color=7,
pos="1478.5,58.912 1507.1,48.674 1550.1,33.25 1578.6,23.031"];
52 [color=9,
height=0.31944,
label="+",
pos="1672,11.5",
width=0.34722];
44 -> 52 [color=9,
pos="1479.2,64.634 1519,57.739 1591,43.627 1650,23 1653,21.939 1656.2,20.582 1659.2,19.199"];
53 [color=11,
height=0.31944,
label="idRHS e",
pos="1735,11.5",
width=0.90278];
44 -> 53 [color=11,
pos="1479.3,64.384 1525.7,56.405 1617.1,40.129 1694,23 1696.7,22.393 1699.5,21.735 1702.4,21.054"];
55 [color=2,
height=0.31944,
label="literal 0",
pos="772,129.5",
width=0.77778];
54 -> 55 [color=2,
pos="767.94,176.78 768.83,166.59 770.17,151.35 771.06,141.17"];
}
给予:
我正在使用 graphviz 在我正在做的编译器项目中可视化 AST 树,但一个大问题是树可能变得非常大,一些节点有很多 child仁。 这导致发生的是一些 parent 节点将与其 parent 严重分离,因为它们的 children 迫使它们这样做。
看起来像这样:
我的问题是,是否可以让所有只有一个 child 的节点直接位于其下方节点的上方?因此,“decl f”节点将位于“assignment”节点的正上方,而该赋值节点位于“additive”节点的正上方。
我尝试在“decl f”和“additive”节点之间使用不可见的边缘和强大的权重来做到这一点,但这最终会抵消“assignment”节点,因此它不会与看不见的边缘。
代码是自动生成的,但我还是把输出放在这里。此输出适用于此图表:
digraph "ast tree" {
graph [bb="0,0,1767.5,377",
bgcolor=grey12,
concentrate=true,
splines=true
];
node [color=1,
colorscheme=rdylbu11,
fontcolor=white,
height=0,
label="\N",
margins=0.08,
shape=box,
width=0
];
edge [arrowhead=none,
color=white,
colorscheme=rdylbu11,
constraint=true,
penwidth=0.5
];
1 [height=0.31944,
label=program,
pos="270,365.5",
width=0.88889];
2 [height=0.31944,
label=function,
pos="230,306.5",
width=0.86111];
1 -> 2 [color=1,
pos="262.48,353.78 255.32,343.59 244.63,328.35 237.49,318.17"];
10 [color=5,
height=0.31944,
label=function,
pos="396,306.5",
width=0.86111];
1 -> 10 [color=5,
pos="293.4,353.91 316.04,343.67 350.13,328.25 372.72,318.03"];
3 [height=0.31944,
label=scope,
pos="135,247.5",
width=0.69444];
2 -> 3 [color=1,
pos="212.13,294.78 195.15,284.59 169.75,269.35 152.79,259.17"];
4 [height=0.31944,
label=scope,
pos="39,188.5",
width=0.69444];
3 -> 4 [color=1,
pos="116.94,235.78 99.78,225.59 74.112,210.35 56.976,200.17"];
8 [color=3,
height=0.31944,
label="return statement",
pos="135,188.5",
width=1.4583];
3 -> 8 [color=3,
pos="135,235.78 135,225.59 135,210.35 135,200.17"];
5 [height=0.31944,
label="decl a",
pos="39,129.5",
width=0.69444];
4 -> 5 [color=1,
pos="39,176.78 39,166.59 39,151.35 39,141.17"];
6 [height=0.31944,
label=assignment,
pos="39,70.5",
width=1.0833];
5 -> 6 [color=1,
pos="39,117.78 39,107.59 39,92.348 39,82.173"];
7 [height=0.31944,
label="literal 0",
pos="39,11.5",
width=0.77778];
6 -> 7 [color=1,
pos="39,58.779 39,48.588 39,33.348 39,23.173"];
9 [color=3,
height=0.31944,
label="literal 0",
pos="122,129.5",
width=0.77778];
8 -> 9 [color=3,
pos="132.55,176.78 130.23,166.59 126.75,151.35 124.43,141.17"];
11 [color=5,
height=0.31944,
label=scope,
pos="445,247.5",
width=0.69444];
10 -> 11 [color=5,
pos="405.22,294.78 413.98,284.59 427.08,269.35 435.82,259.17"];
12 [color=5,
height=0.31944,
label="decl a",
pos="253,188.5",
width=0.69444];
11 -> 12 [color=5,
pos="419.9,239.05 383.1,228.12 314.91,207.88 278.11,196.95"];
15 [color=7,
height=0.31944,
label="decl b",
pos="331,188.5",
width=0.70833];
11 -> 15 [color=7,
pos="423.82,235.91 403.35,225.67 372.5,210.25 352.06,200.03"];
18 [color=9,
height=0.31944,
label="decl c",
pos="404,188.5",
width=0.69444];
11 -> 18 [color=9,
pos="437.29,235.78 429.96,225.59 419,210.35 411.68,200.17"];
24 [color=4,
height=0.31944,
label="decl d",
pos="486,188.5",
width=0.70833];
11 -> 24 [color=4,
pos="452.71,235.78 460.04,225.59 471,210.35 478.32,200.17"];
32 [color=3,
height=0.31944,
label="decl e",
pos="575,188.5",
width=0.69444];
11 -> 32 [color=3,
pos="469.15,235.91 492.5,225.67 527.68,210.25 550.98,200.03"];
42 [color=6,
height=0.31944,
label="decl f",
pos="662,188.5",
width=0.66667];
11 -> 42 [color=6,
pos="470.32,239.85 512.47,228.78 596.47,206.71 637.84,195.85"];
54 [color=2,
height=0.31944,
label="return statement",
pos="767,188.5",
width=1.4583];
11 -> 54 [color=2,
pos="470.27,242.03 522.68,232.75 644.17,211.24 714.36,198.82"];
13 [color=5,
height=0.31944,
label=assignment,
pos="207,129.5",
width=1.0833];
12 -> 13 [color=5,
pos="244.35,176.78 236.12,166.59 223.82,151.35 215.61,141.17"];
14 [color=5,
height=0.31944,
label="literal 0",
pos="194,70.5",
width=0.77778];
13 -> 14 [color=5,
pos="204.55,117.78 202.23,107.59 198.75,92.348 196.43,82.173"];
16 [color=7,
height=0.31944,
label=assignment,
pos="303,129.5",
width=1.0833];
15 -> 16 [color=7,
pos="325.73,176.78 320.73,166.59 313.24,151.35 308.24,141.17"];
17 [color=7,
height=0.31944,
label="idRHS a",
pos="273,70.5",
width=0.90278];
16 -> 17 [color=7,
pos="297.36,117.78 291.99,107.59 283.97,92.348 278.62,82.173"];
19 [color=9,
height=0.31944,
label=assignment,
pos="399,129.5",
width=1.0833];
18 -> 19 [color=9,
pos="403.06,176.78 402.17,166.59 400.83,151.35 399.94,141.17"];
20 [color=9,
height=0.31944,
label=additive,
pos="354,70.5",
width=0.83333];
19 -> 20 [color=9,
pos="390.54,117.78 382.49,107.59 370.46,92.348 362.43,82.173"];
21 [color=9,
height=0.31944,
label="idRHS a",
pos="214,11.5",
width=0.90278];
20 -> 21 [color=9,
pos="328,58.912 302.85,48.674 264.96,33.25 239.87,23.031"];
22 [color=11,
height=0.31944,
label="+",
pos="277,11.5",
width=0.34722];
20 -> 22 [color=11,
pos="339.52,58.779 325.23,48.201 303.59,32.183 289.88,22.037"];
23 [color=2,
height=0.31944,
label="idRHS b",
pos="341,11.5",
width=0.91667];
20 -> 23 [color=2,
pos="351.55,58.779 349.23,48.588 345.75,33.348 343.43,23.173"];
25 [color=4,
height=0.31944,
label=assignment,
pos="495,129.5",
width=1.0833];
24 -> 25 [color=4,
pos="487.69,176.78 489.3,166.59 491.71,151.35 493.31,141.17"];
26 [color=4,
height=0.31944,
label=additive,
pos="520,70.5",
width=0.83333];
25 -> 26 [color=4,
pos="499.7,117.78 504.17,107.59 510.86,92.348 515.32,82.173"];
27 [color=4,
height=0.31944,
label="idRHS a",
pos="425,11.5",
width=0.90278];
26 -> 27 [color=4,
pos="502.13,58.779 485.15,48.588 459.75,33.348 442.79,23.173"];
28 [color=6,
height=0.31944,
label="+",
pos="488,11.5",
width=0.34722];
26 -> 28 [color=6,
pos="513.98,58.779 508.26,48.588 499.7,33.348 493.99,23.173"];
29 [color=8,
height=0.31944,
label="idRHS b",
pos="552,11.5",
width=0.91667];
26 -> 29 [color=8,
pos="526.02,58.779 531.74,48.588 540.3,33.348 546.01,23.173"];
30 [color=10,
height=0.31944,
label="+",
pos="616,11.5",
width=0.34722];
26 -> 30 [color=10,
pos="538.06,58.779 557.07,47.492 586.51,30.01 603.24,20.077"];
31 [height=0.31944,
label="idRHS c",
pos="679,11.5",
width=0.90278];
26 -> 31 [color=1,
pos="549.53,58.912 578.09,48.674 621.12,33.25 649.62,23.031"];
33 [color=3,
height=0.31944,
label=assignment,
pos="591,129.5",
width=1.0833];
32 -> 33 [color=3,
pos="578.01,176.78 580.87,166.59 585.15,151.35 588,141.17"];
34 [color=3,
height=0.31944,
label=additive,
pos="921,70.5",
width=0.83333];
33 -> 34 [color=3,
pos="630.26,119.74 633.21,119.13 636.15,118.55 639,118 730.37,100.48 839.18,83.682 890.86,75.944"];
35 [color=3,
height=0.31944,
label="idRHS a",
pos="762,11.5",
width=0.90278];
34 -> 35 [color=3,
pos="891.47,58.912 862.91,48.674 819.88,33.25 791.38,23.031"];
36 [color=5,
height=0.31944,
label="+",
pos="825,11.5",
width=0.34722];
34 -> 36 [color=5,
pos="902.94,58.779 883.93,47.492 854.49,30.01 837.76,20.077"];
37 [color=7,
height=0.31944,
label="idRHS b",
pos="889,11.5",
width=0.91667];
34 -> 37 [color=7,
pos="914.98,58.779 909.26,48.588 900.7,33.348 894.99,23.173"];
38 [color=9,
height=0.31944,
label="+",
pos="953,11.5",
width=0.34722];
34 -> 38 [color=9,
pos="927.02,58.779 932.74,48.588 941.3,33.348 947.01,23.173"];
39 [color=11,
height=0.31944,
label="idRHS c",
pos="1016,11.5",
width=0.90278];
34 -> 39 [color=11,
pos="938.87,58.779 955.85,48.588 981.25,33.348 998.21,23.173"];
40 [color=2,
height=0.31944,
label="+",
pos="1079,11.5",
width=0.34722];
34 -> 40 [color=2,
pos="951.1,60.584 979.15,51.97 1022,38.045 1058,23 1060.7,21.869 1063.6,20.544 1066.2,19.223"];
41 [color=4,
height=0.31944,
label="idRHS d",
pos="1143,11.5",
width=0.91667];
34 -> 41 [color=4,
pos="951.4,61.694 992.85,51.053 1066.8,32.061 1109.7,21.048"];
43 [color=6,
height=0.31944,
label=assignment,
pos="687,129.5",
width=1.0833];
42 -> 43 [color=6,
pos="666.7,176.78 671.17,166.59 677.86,151.35 682.32,141.17"];
44 [color=6,
height=0.31944,
label=additive,
pos="1449,70.5",
width=0.83333];
43 -> 44 [color=6,
pos="726.21,119.42 729.17,118.89 732.13,118.41 735,118 998.22,80.853 1320.3,73.317 1418.9,71.845"];
45 [color=6,
height=0.31944,
label="idRHS a",
pos="1227,11.5",
width=0.90278];
44 -> 45 [color=6,
pos="1418.6,61.694 1376.9,50.992 1302.3,31.843 1259.6,20.859"];
46 [color=8,
height=0.31944,
label="+",
pos="1290,11.5",
width=0.34722];
44 -> 46 [color=8,
pos="1419,60.43 1391,51.709 1348.2,37.714 1312,23 1309,21.788 1305.9,20.371 1302.9,18.976"];
47 [color=10,
height=0.31944,
label="idRHS b",
pos="1354,11.5",
width=0.91667];
44 -> 47 [color=10,
pos="1431.1,58.779 1414.1,48.588 1388.7,33.348 1371.8,23.173"];
48 [height=0.31944,
label="+",
pos="1418,11.5",
width=0.34722];
44 -> 48 [color=1,
pos="1443.2,58.779 1437.6,48.588 1429.3,33.348 1423.8,23.173"];
49 [color=3,
height=0.31944,
label="idRHS c",
pos="1481,11.5",
width=0.90278];
44 -> 49 [color=3,
pos="1455,58.779 1460.7,48.588 1469.3,33.348 1475,23.173"];
50 [color=5,
height=0.31944,
label="+",
pos="1544,11.5",
width=0.34722];
44 -> 50 [color=5,
pos="1466.9,58.779 1485.7,47.492 1514.8,30.01 1531.4,20.077"];
51 [color=7,
height=0.31944,
label="idRHS d",
pos="1608,11.5",
width=0.91667];
44 -> 51 [color=7,
pos="1478.5,58.912 1507.1,48.674 1550.1,33.25 1578.6,23.031"];
52 [color=9,
height=0.31944,
label="+",
pos="1672,11.5",
width=0.34722];
44 -> 52 [color=9,
pos="1479.2,64.634 1519,57.739 1591,43.627 1650,23 1653,21.939 1656.2,20.582 1659.2,19.199"];
53 [color=11,
height=0.31944,
label="idRHS e",
pos="1735,11.5",
width=0.90278];
44 -> 53 [color=11,
pos="1479.3,64.384 1525.7,56.405 1617.1,40.129 1694,23 1696.7,22.393 1699.5,21.735 1702.4,21.054"];
55 [color=2,
height=0.31944,
label="literal 0",
pos="772,129.5",
width=0.77778];
54 -> 55 [color=2,
pos="767.94,176.78 768.83,166.59 770.17,151.35 771.06,141.17"];
}
(您还可以查看 circo & twopi 引擎)
让节点垂直排列的技巧是为这些节点集的每一个分配一个唯一的 group 属性 (https://graphviz.org/docs/attrs/group/)。像这样:
digraph "ast tree" {
graph [bb="0,0,1767.5,377",
bgcolor=grey12,
concentrate=true,
splines=true
];
node [color=1,
colorscheme=rdylbu11,
fontcolor=white,
height=0,
label="\N",
margins=0.08,
shape=box,
width=0
];
edge [arrowhead=none,
color=white,
colorscheme=rdylbu11,
constraint=true,
penwidth=0.5
];
1 [height=0.31944,
label=program,
pos="270,365.5",
width=0.88889];
2 [height=0.31944,
label=function,
pos="230,306.5",
width=0.86111];
1 -> 2 [color=1,
pos="262.48,353.78 255.32,343.59 244.63,328.35 237.49,318.17"];
10 [color=5,
height=0.31944,
label=function,
pos="396,306.5",
width=0.86111];
1 -> 10 [color=5,
pos="293.4,353.91 316.04,343.67 350.13,328.25 372.72,318.03"];
3 [height=0.31944,
label=scope,
pos="135,247.5",
width=0.69444];
2 -> 3 [color=1,
pos="212.13,294.78 195.15,284.59 169.75,269.35 152.79,259.17"];
4 [height=0.31944,
label=scope,
pos="39,188.5",
width=0.69444];
3 -> 4 [color=1,
pos="116.94,235.78 99.78,225.59 74.112,210.35 56.976,200.17"];
8 [color=3,
height=0.31944,
label="return statement",
pos="135,188.5",
width=1.4583];
3 -> 8 [color=3,
pos="135,235.78 135,225.59 135,210.35 135,200.17"];
5 [height=0.31944,
label="decl a",
pos="39,129.5",
width=0.69444];
4 -> 5 [color=1,
pos="39,176.78 39,166.59 39,151.35 39,141.17"];
6 [height=0.31944,
label=assignment,
pos="39,70.5",
width=1.0833];
5 -> 6 [color=1,
pos="39,117.78 39,107.59 39,92.348 39,82.173"];
7 [height=0.31944,
label="literal 0",
pos="39,11.5",
width=0.77778];
6 -> 7 [color=1,
pos="39,58.779 39,48.588 39,33.348 39,23.173"];
9 [color=3,
height=0.31944,
label="literal 0",
pos="122,129.5",
width=0.77778];
8 -> 9 [color=3,
pos="132.55,176.78 130.23,166.59 126.75,151.35 124.43,141.17"];
11 [color=5,
height=0.31944,
label=scope,
pos="445,247.5",
width=0.69444];
10 -> 11 [color=5,
pos="405.22,294.78 413.98,284.59 427.08,269.35 435.82,259.17"];
12 [color=5,
height=0.31944,
label="decl a",
pos="253,188.5",
width=0.69444];
11 -> 12 [color=5,
pos="419.9,239.05 383.1,228.12 314.91,207.88 278.11,196.95"];
15 [color=7,
height=0.31944,
label="decl b",
pos="331,188.5",
width=0.70833];
11 -> 15 [color=7,
pos="423.82,235.91 403.35,225.67 372.5,210.25 352.06,200.03"];
18 [color=9,
height=0.31944,
label="decl c",
pos="404,188.5",
width=0.69444];
11 -> 18 [color=9,
pos="437.29,235.78 429.96,225.59 419,210.35 411.68,200.17"];
24 [color=4,
height=0.31944,
label="decl d",
pos="486,188.5",
width=0.70833];
11 -> 24 [color=4,
pos="452.71,235.78 460.04,225.59 471,210.35 478.32,200.17"];
32 [color=3,
height=0.31944,
label="decl e",
pos="575,188.5",
width=0.69444];
11 -> 32 [color=3,
pos="469.15,235.91 492.5,225.67 527.68,210.25 550.98,200.03"];
42 [color=6,
height=0.31944,
label="decl f",
pos="662,188.5",
width=0.66667];
11 -> 42 [color=6,
pos="470.32,239.85 512.47,228.78 596.47,206.71 637.84,195.85"];
54 [color=2,
height=0.31944,
label="return statement",
pos="767,188.5",
width=1.4583];
11 -> 54 [color=2,
pos="470.27,242.03 522.68,232.75 644.17,211.24 714.36,198.82"];
13 [color=5,
height=0.31944,
label=assignment,
pos="207,129.5",
width=1.0833];
12 -> 13 [color=5,
pos="244.35,176.78 236.12,166.59 223.82,151.35 215.61,141.17"];
14 [color=5,
height=0.31944,
label="literal 0",
pos="194,70.5",
width=0.77778];
13 -> 14 [color=5,
pos="204.55,117.78 202.23,107.59 198.75,92.348 196.43,82.173"];
16 [color=7,
height=0.31944,
label=assignment,
pos="303,129.5",
width=1.0833];
15 -> 16 [color=7,
pos="325.73,176.78 320.73,166.59 313.24,151.35 308.24,141.17"];
17 [color=7,
height=0.31944,
label="idRHS a",
pos="273,70.5",
width=0.90278];
16 -> 17 [color=7,
pos="297.36,117.78 291.99,107.59 283.97,92.348 278.62,82.173"];
19 [color=9,
height=0.31944,
label=assignment,
pos="399,129.5",
width=1.0833];
18 -> 19 [color=9,
pos="403.06,176.78 402.17,166.59 400.83,151.35 399.94,141.17"];
20 [color=9,
height=0.31944,
label=additive,
pos="354,70.5",
width=0.83333];
19 -> 20 [color=9,
pos="390.54,117.78 382.49,107.59 370.46,92.348 362.43,82.173"];
21 [color=9,
height=0.31944,
label="idRHS a",
pos="214,11.5",
width=0.90278];
20 -> 21 [color=9,
pos="328,58.912 302.85,48.674 264.96,33.25 239.87,23.031"];
22 [color=11,
height=0.31944,
label="+",
pos="277,11.5",
width=0.34722];
20 -> 22 [color=11,
pos="339.52,58.779 325.23,48.201 303.59,32.183 289.88,22.037"];
23 [color=2,
height=0.31944,
label="idRHS b",
pos="341,11.5",
width=0.91667];
20 -> 23 [color=2,
pos="351.55,58.779 349.23,48.588 345.75,33.348 343.43,23.173"];
25 [color=4,
height=0.31944,
label=assignment,
pos="495,129.5",
width=1.0833];
24 -> 25 [color=4,
pos="487.69,176.78 489.3,166.59 491.71,151.35 493.31,141.17"];
26 [color=4,
height=0.31944,
label=additive,
pos="520,70.5",
width=0.83333];
25 -> 26 [color=4,
pos="499.7,117.78 504.17,107.59 510.86,92.348 515.32,82.173"];
27 [color=4,
height=0.31944,
label="idRHS a",
pos="425,11.5",
width=0.90278];
26 -> 27 [color=4,
pos="502.13,58.779 485.15,48.588 459.75,33.348 442.79,23.173"];
28 [color=6,
height=0.31944,
label="+",
pos="488,11.5",
width=0.34722];
26 -> 28 [color=6,
pos="513.98,58.779 508.26,48.588 499.7,33.348 493.99,23.173"];
29 [color=8,
height=0.31944,
label="idRHS b",
pos="552,11.5",
width=0.91667];
26 -> 29 [color=8,
pos="526.02,58.779 531.74,48.588 540.3,33.348 546.01,23.173"];
30 [color=10,
height=0.31944,
label="+",
pos="616,11.5",
width=0.34722];
26 -> 30 [color=10,
pos="538.06,58.779 557.07,47.492 586.51,30.01 603.24,20.077"];
31 [height=0.31944,
label="idRHS c",
pos="679,11.5",
width=0.90278];
26 -> 31 [color=1,
pos="549.53,58.912 578.09,48.674 621.12,33.25 649.62,23.031"];
33 [color=3,
height=0.31944,
label=assignment,
pos="591,129.5",
width=1.0833];
32 -> 33 [color=3,
pos="578.01,176.78 580.87,166.59 585.15,151.35 588,141.17"];
34 [color=3,
height=0.31944,
label=additive,
pos="921,70.5",
width=0.83333];
33 -> 34 [color=3,
pos="630.26,119.74 633.21,119.13 636.15,118.55 639,118 730.37,100.48 839.18,83.682 890.86,75.944"];
35 [color=3,
height=0.31944,
label="idRHS a",
pos="762,11.5",
width=0.90278];
34 -> 35 [color=3,
pos="891.47,58.912 862.91,48.674 819.88,33.25 791.38,23.031"];
36 [color=5,
height=0.31944,
label="+",
pos="825,11.5",
width=0.34722];
34 -> 36 [color=5,
pos="902.94,58.779 883.93,47.492 854.49,30.01 837.76,20.077"];
37 [color=7,
height=0.31944,
label="idRHS b",
pos="889,11.5",
width=0.91667];
34 -> 37 [color=7,
pos="914.98,58.779 909.26,48.588 900.7,33.348 894.99,23.173"];
38 [color=9,
height=0.31944,
label="+",
pos="953,11.5",
width=0.34722];
34 -> 38 [color=9,
pos="927.02,58.779 932.74,48.588 941.3,33.348 947.01,23.173"];
39 [color=11,
height=0.31944,
label="idRHS c",
pos="1016,11.5",
width=0.90278];
34 -> 39 [color=11,
pos="938.87,58.779 955.85,48.588 981.25,33.348 998.21,23.173"];
40 [color=2,
height=0.31944,
label="+",
pos="1079,11.5",
width=0.34722];
34 -> 40 [color=2,
pos="951.1,60.584 979.15,51.97 1022,38.045 1058,23 1060.7,21.869 1063.6,20.544 1066.2,19.223"];
41 [color=4,
height=0.31944,
label="idRHS d",
pos="1143,11.5",
width=0.91667];
34 -> 41 [color=4,
pos="951.4,61.694 992.85,51.053 1066.8,32.061 1109.7,21.048"];
43 [color=6,
height=0.31944,
label=assignment,
pos="687,129.5",
width=1.0833];
42 -> 43 [color=6,
pos="666.7,176.78 671.17,166.59 677.86,151.35 682.32,141.17"];
44 [color=6,
height=0.31944,
label=additive,
pos="1449,70.5",
width=0.83333];
43 -> 44 [color=6,
pos="726.21,119.42 729.17,118.89 732.13,118.41 735,118 998.22,80.853 1320.3,73.317 1418.9,71.845"];
45 [color=6,
height=0.31944,
label="idRHS a",
pos="1227,11.5",
width=0.90278];
44 -> 45 [color=6,
pos="1418.6,61.694 1376.9,50.992 1302.3,31.843 1259.6,20.859"];
46 [color=8,
height=0.31944,
label="+",
pos="1290,11.5",
width=0.34722];
44 -> 46 [color=8,
pos="1419,60.43 1391,51.709 1348.2,37.714 1312,23 1309,21.788 1305.9,20.371 1302.9,18.976"];
47 [color=10,
height=0.31944,
label="idRHS b",
pos="1354,11.5",
width=0.91667];
44 -> 47 [color=10,
pos="1431.1,58.779 1414.1,48.588 1388.7,33.348 1371.8,23.173"];
48 [height=0.31944,
label="+",
pos="1418,11.5",
width=0.34722];
44 -> 48 [color=1,
pos="1443.2,58.779 1437.6,48.588 1429.3,33.348 1423.8,23.173"];
49 [color=3,
height=0.31944,
label="idRHS c",
pos="1481,11.5",
width=0.90278];
44 -> 49 [color=3,
pos="1455,58.779 1460.7,48.588 1469.3,33.348 1475,23.173"];
50 [color=5,
height=0.31944,
label="+",
pos="1544,11.5",
width=0.34722];
44 -> 50 [color=5,
pos="1466.9,58.779 1485.7,47.492 1514.8,30.01 1531.4,20.077"];
51 [color=7,
height=0.31944,
label="idRHS d",
pos="1608,11.5",
width=0.91667];
44 -> 51 [color=7,
pos="1478.5,58.912 1507.1,48.674 1550.1,33.25 1578.6,23.031"];
52 [color=9,
height=0.31944,
label="+",
pos="1672,11.5",
width=0.34722];
44 -> 52 [color=9,
pos="1479.2,64.634 1519,57.739 1591,43.627 1650,23 1653,21.939 1656.2,20.582 1659.2,19.199"];
53 [color=11,
height=0.31944,
label="idRHS e",
pos="1735,11.5",
width=0.90278];
44 -> 53 [color=11,
pos="1479.3,64.384 1525.7,56.405 1617.1,40.129 1694,23 1696.7,22.393 1699.5,21.735 1702.4,21.054"];
55 [color=2,
height=0.31944,
label="literal 0",
pos="772,129.5",
width=0.77778];
54 -> 55 [color=2,
pos="767.94,176.78 768.83,166.59 770.17,151.35 771.06,141.17"];
}
给予: