我希望在某些边缘的中心有一个大点(或类似的东西)。 以下代码是我能够制作的最佳代码。
digraph BDD {
ordering = out;
splines = true;
edge [arrowhead="none"];
node [shape = none, label = "SUM"] 0;
node [shape = circle, label = "x"] 1;
node [shape = circle, label = "y"] 2;
node [shape = circle, label = "w"] 3;
node [shape = none, label = "1"] 4;
node [shape = circle, label = "z"] 5;
node [shape = none, label = "1"] 6;
node [shape = circle, label = "y"] 7;
node [shape = circle, label = "w"] 8;
node [shape = none, label = "1"] 9;
0 -> 1;
1 -> 2;
1 -> 7 [arrowhead="dot"];
2 -> 3;
2 -> 5 [arrowhead="dot"];
3 -> 4 [arrowhead="dot"];
3 -> 4;
5 -> 6 [arrowhead="dot"];
5 -> 6;
7 -> 5;
7 -> 8;
8 -> 9;
8 -> 5;
}
这将生成以下图像,这不太正确,因为点位于边缘的末端。
任何人都可以建议我解决这个问题:
编辑1:使用额外节点作为点会产生不可接受的输出。
digraph BDD {
ordering = out;
splines = true;
edge [arrowhead="none"];
node [shape = none, label = "SUM"] 0;
node [shape = circle, label = "x"] 1;
node [shape = circle, label = "y"] 2;
node [shape = circle, label = "w"] 3;
node [shape = none, label = "1"] 4;
node [shape = circle, label = "z"] 5;
node [shape = none, label = "1"] 6;
node [shape = circle, label = "y"] 7;
node [shape = circle, label = "w"] 8;
node [shape = none, label = "1"] 9;
0 -> 1;
1 -> 2;
node [shape = point width=0.1] p1p7;
1 -> p1p7 -> 7;
2 -> 3;
node [shape = point width=0.1] p2p5;
2 -> p2p5 -> 5;
node [shape = point width=0.1] p3p4;
3 -> p3p4 -> 4;
3 -> 4;
node [shape = point width=0.1] p5p6;
5 -> p5p6 -> 6;
5 -> 6;
7 -> 5;
7 -> 8;
8 -> 9;
8 -> 5;
}
编辑2:我也可以接受一个图表,其中点不在中心。他们只能触摸节点,也就是说如果我可以设置/设置箭头和节点之间的距离就可以了。
答案 0 :(得分:2)
你可以创建一个额外的节点(和一个额外的边缘)来实现这一点。
digraph {
node [shape = circle]
A
C
node [shape = point width=0.2]
B
edge [arrowhead=none]
A -> B -> C
}
产生
编辑:
您可以将图形布局为* .dot文件,其中放置了所有节点和边。那么你可以使用自己喜欢的编程语言来阅读和修改该文件。还有一些我还没有尝试过的内置脚本语言。最后,使用nop2-engine将修改后的DOT文件转换为您选择的图像格式。您必须了解如何在Bezier样条曲线上放置点。根据文件
splineType
spline ( ';' spline )*
where spline = (endp)? (startp)? point (triple)+
and triple = point point point
and endp = "e,%f,%f"
and startp = "s,%f,%f"
每个边缘总是有4 + 3n(0 <= n)个点。这些是3个三次样条曲线,其中一个样条曲线的终点是下一个样条曲线的起点。当直接触摸起点/终点时,如果存在至少两个样条(7个点),则它们是放置点的候选者。通常,每个点[4 + 3n]都是候选者。如果我们有一个样条曲线,则此方法失败。我们必须在样条上放置一个点。有效的4元组从0 + 3n开始,以3 + 3n结束。
您可以使用任何有效的4元组x / y坐标来计算样条曲线上的点
x = (x1 + 3*x2 + 3*x3 + x4)/8
这是分隔符2的简单公式。类似于y坐标。
示例:
digraph { rankdir = LR ranksep=1 nodesep=1 pad=0.5
node [shape = circle]
edge [arrowhead=none]
{ rank=same
A -> B
B -> C
A -> C
}
}
给出
digraph {
graph [bb="0,0,74.575,252",
nodesep=1,
pad=0.5,
rankdir=LR,
ranksep=1
];
node [label="\N",
shape=circle
];
edge [arrowhead=none];
{
graph [rank=same];
A [height=0.5,
pos="56.575,234",
width=0.5];
B [height=0.5,
pos="56.575,126",
width=0.5];
A -> B [pos="56.575,215.75 56.575,191.88 56.575,168.01 56.575,144.14"];
C [height=0.5,
pos="56.575,18",
width=0.5];
A -> C [pos="44.02,220.46 24.619,197.84 -9.2417,150.66 2.5745,108 10.795,78.323 31.695,48.606 44.952,31.836"];
B -> C [pos="56.575,107.75 56.575,83.878 56.575,60.01 56.575,36.141"];
}
}
行边缘
A -> C [pos="44.02,220.46 24.619,197.84 -9.2417,150.66 2.5745,108 10.795,78.323 31.695,48.606 44.952,31.836"];
由2个样条组成。我们有一个可以直接使用的重叠起点/终点
U1 [shape=point width=0.2 color=red pos="2.5745,108"]
从上面选择的边缘有2个有效的4元组可供选择,在样条曲线上产生2个点(对于divider2)
X1 [shape=point width=0.2 pos="11.59,171.75"]
X2 [shape=point width=0.2 pos="21.87,65.08"]
合并文件
digraph {
graph [bb="0,0,74.575,252",
nodesep=1,
pad=0.5,
rankdir=LR,
ranksep=1
];
node [label="\N",
shape=circle
];
edge [arrowhead=none];
{
graph [rank=same];
A [height=0.5,
pos="56.575,234",
width=0.5];
B [height=0.5,
pos="56.575,126",
width=0.5];
A -> B [pos="56.575,215.75 56.575,191.88 56.575,168.01 56.575,144.14"];
C [height=0.5,
pos="56.575,18",
width=0.5];
A -> C [pos="44.02,220.46 24.619,197.84 -9.2417,150.66 2.5745,108 10.795,78.323 31.695,48.606 44.952,31.836"];
B -> C [pos="56.575,107.75 56.575,83.878 56.575,60.01 56.575,36.141"];
U1 [shape=point width=0.2 color=red pos="2.5745,108"]
X1 [shape=point width=0.2 pos="11.59,171.75"]
X2 [shape=point width=0.2 pos="21.87,65.08"]
}
}
给出