Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
增加graphviz中边缘的分离_Graphviz_Dot - Fatal编程技术网

增加graphviz中边缘的分离

增加graphviz中边缘的分离,graphviz,dot,Graphviz,Dot,当目标形状是一个狭窄的矩形(H=0.5,W=0.05)时,我用点图和边/箭头(2+)创建了几个UML活动图。如果目标形状为正方形(H=0.5,W=0.5),则不会出现此问题 下面是一个减少点的示例: digraph G { graph [ ranksep = 0.5, rankdir = LR ] A4 [ shape = "record", height = 0.5, fontsize = 10, margin = "0.20,0.05", label = "Output\ to\rPrevi

当目标形状是一个狭窄的矩形(H=0.5,W=0.05)时,我用点图和边/箭头(2+)创建了几个UML活动图。如果目标形状为正方形(H=0.5,W=0.5),则不会出现此问题

下面是一个减少点的示例:

digraph G {
graph [ ranksep = 0.5, rankdir = LR ]
A4 [ shape = "record", height = 0.5, fontsize = 10, margin = "0.20,0.05", label = "Output\ to\rPreviewer", style = "rounded" ]
A5 [ shape = "rectangle", height = 0.5, width = 0.05, margin = "0,0", style = "filled", label = "" ]
A4 -> A5 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10 ]
A6 [ shape = "diamond", height = 0.5, width = 0.5, margin = "0,0", label = "" ]
A6 -> A5 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10, label = "[generate: false]" ]
A7 [ shape = "record", height = 0.5, fontsize = 10, margin = "0.20,0.05", label = "Output\ to\rFile", style = "rounded" ]
A6 -> A7 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10, label = "[generate: true]" ]
A8 [ shape = "doublecircle", height = 0.3, width = 0.3, margin = "0,0", label = "" ]
A7 -> A5 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10 ]
A5 -> A8 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10 ]
}
上面的文本在中生成下图

理想的输出如下


我发现了一个可以产生良好输出的调整,但需要大量处理、边缘计数和方向感知:

digraph G {
graph [ ranksep = 0.5, rankdir = LR ]
A4 [ shape = "record", height = 0.5, fontsize = 10, margin = "0.20,0.05", label = "Output\ to\rPreviewer", style = "rounded" ]
A5 [ shape = "record", height = 0.5, width = 0.05, margin = "0,0", style = "filled", label = "<f0>|<f1>|<f2>", fillcolor="black" ]
A4 -> A5:f0:w [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10 ]
A6 [ shape = "diamond", height = 0.5, width = 0.5, margin = "0,0", label = "" ]
A6 -> A5:f1:w [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10, label = "[generate: false]" ]
A7 [ shape = "record", height = 0.5, fontsize = 10, margin = "0.20,0.05", label = "Output\ to\rFile", style = "rounded" ]
A6 -> A7 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10, label = "[generate: true]" ]
A8 [ shape = "doublecircle", height = 0.3, width = 0.3, margin = "0,0", label = "" ]
A7 -> A5:f2:w [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10 ]
A5 -> A8 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10 ]
}
有向图G{
图[ranksep=0.5,rankdir=LR]
A4[shape=“record”,高度=0.5,字体大小=10,边距=0.20,0.05”,标签=“Output\to\rPreviewer”,style=“rounded”]
A5[shape=“record”,高度=0.5,宽度=0.05,边距=“0,0”,style=“filled”,label=“| |”,fillcolor=“black”]
A4->A5:f0:w[shape=“edge”、dir=“both”、style=“solid”、arrowtail=“none”、arrowhead=“vee”、labeldistance=1、fontsize=10]
A6[形状=“菱形”,高度=0.5,宽度=0.5,边距=“0,0”,标签=“”]
A6->A5:f1:w[shape=“edge”、dir=“both”、style=“solid”、arrowtail=“none”、arrowhead=“vee”、labeldistance=1、fontsize=10、label=“[generate:false]”
A7[shape=“record”,高度=0.5,字体大小=10,边距=“0.20,0.05”,标签=“Output\to\rFile”,style=“rounded”]
A6->A7[shape=“edge”、dir=“both”、style=“solid”、arrowtail=“none”、arrowhead=“vee”、labeldistance=1、fontsize=10、label=“[generate:true]”
A8[形状=“双圆”,高度=0.3,宽度=0.3,边距=“0,0”,标签=“”]
A7->A5:f2:w[shape=“edge”,dir=“both”,style=“solid”,arrowtail=“none”,arrowhead=“vee”,labeldistance=1,fontsize=10]
A5->A8[shape=“edge”、dir=“both”、style=“solid”、arrowtail=“none”、arrowhead=“vee”、labeldistance=1、fontsize=10]
}
这是输出:


我仍然想知道是否有一个更简单的解决方案。

您可以将所有边的输出端口指定为
east
,并获得一个很好的结果(至少在这种情况下):

有向图G{
图[ranksep=0.5,rankdir=LR]
edge[tailport=e]#A5[shape=“edge”、dir=“both”、style=“solid”、arrowtail=“none”、arrowhead=“vee”、labeldistance=1、fontsize=10]
A6[形状=“菱形”,高度=0.5,宽度=0.5,边距=“0,0”,标签=“”]
A6->A5[shape=“edge”、dir=“both”、style=“solid”、arrowtail=“none”、arrowhead=“vee”、labeldistance=1、fontsize=10、label=“[generate:false]”
A7[shape=“record”,高度=0.5,字体大小=10,边距=“0.20,0.05”,标签=“Output\to\rFile”,style=“rounded”]
A6->A7[shape=“edge”、dir=“both”、style=“solid”、arrowtail=“none”、arrowhead=“vee”、labeldistance=1、fontsize=10、label=“[generate:true]”
A8[形状=“双圆”,高度=0.3,宽度=0.3,边距=“0,0”,标签=“”]
A7->A5[shape=“edge”、dir=“both”、style=“solid”、arrowtail=“none”、arrowhead=“vee”、labeldistance=1、fontsize=10]
A5->A8[shape=“edge”、dir=“both”、style=“solid”、arrowtail=“none”、arrowhead=“vee”、labeldistance=1、fontsize=10]
}
制作:


您可以尝试
A6->A5:nw
A7->A5:sw
。没有给出您想要的输出,但至少分离了边缘。@vaettchen,这听起来不像是一个通用的解决方案,对于提供的示例来说非常具体。如果有4条边就没用了。正确-我尝试了一个解决这个特定问题的方法。也许你编辑了你的帖子,说你正在寻找一个通用的解决方案来解决更多的边/箭头。嗨,Ohad,乍一看,这似乎是一个很好的选择,但对于提供的例子来说,这只是一个巧合。试着注释这行
A7->A5
,原始效果会重新出现。虽然这不是巧合,但你是对的,这不是所有情况下的解决方案。我接受我自己的答案,因为它产生了最好的结果,可以扩展到任何数量的边缘。
digraph G {
        graph [ ranksep = 0.5, rankdir = LR ]
        edge [tailport=e]                    # <----- added this line
        A4 [ shape = "record", height = 0.5, fontsize = 10, margin = "0.20,0.05", label = "Output\ to\rPreviewer", style = "rounded" ]
        A5 [ shape = "rectangle", height = 0.5, width = 0.05, margin = "0,0", style = "filled", label = "" ]
        A4 -> A5 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10 ]
        A6 [ shape = "diamond", height = 0.5, width = 0.5, margin = "0,0", label = "" ]
        A6 -> A5 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10, label     = "[generate: false]" ]
        A7 [ shape = "record", height = 0.5, fontsize = 10, margin = "0.20,0.05", label = "Output\ to\rFile", style = "rounded" ]
        A6 -> A7 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10, label     = "[generate: true]" ]
        A8 [ shape = "doublecircle", height = 0.3, width = 0.3, margin = "0,0", label = "" ]
        A7 -> A5 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10 ]
        A5 -> A8 [ shape = "edge", dir = "both", style = "solid", arrowtail = "none", arrowhead = "vee", labeldistance = 1, fontsize = 10 ]
}