我正在尝试制作一个节点而不影响连接节点的位置。当我绘制图形时,它将父节点居中于子节点之间。这造成了交错效应。如何使故障节点不影响其他节点的布局?我已经使线条像想要的照片一样笔直,但是它仍然具有交错的布局。
当前样式:
所需样式:
编辑: 点码
strict graph "" {
graph [bb="0,0,562,490",
bgcolor="#666666",
fontcolor=white,
fontname=monospace,
label="ACI MSC - Create Bridge Domain - L3",
labelfontsize=40,
labelloc=t,
lheight=0.19,
lp="281,479",
lwidth=3.30,
newrank=yes,
nodesep=0.2,
outputorder=edgesfirst,
overlap=compress,
ranksep=0.5,
splines=spline
];
node [fillcolor=white,
fixedsize=True,
fontcolor=black,
fontname=monospace,
label="\N",
shape=rectangle,
style=filled,
width=5.125
];
edge [fontname=monospace,
fontsize=15,
penwidth=2
];
Start [color=white,
fillcolor=blue,
fixedsize=false,
fontcolor=white,
height=0.5,
pos="377.5,450",
shape=oval,
width=1];
"ACIMSC-CreateSchemaandAddTemplate-Sub" [height=0.5,
pos="377.5,378"];
Start -- "ACIMSC-CreateSchemaandAddTemplate-Sub" [color=green,
pos="377.5,431.83 377.5,421 377.5,407.29 377.5,396.41"];
"ACIMSC-AddBridgeDomaintoTemplate" [height=0.5,
pos="274.5,306"];
"ACIMSC-CreateSchemaandAddTemplate-Sub" -- "ACIMSC-
AddBridgeDomaintoTemplate" [color=green,
pos="351.51,359.83 335.89,348.92 316.1,335.08 300.48,324.16"];
Fail [color=white,
fillcolor=red,
fixedsize=false,
fontcolor=white,
height=0.5,
pos="421.5,18",
shape=oval,
weight=0,
width=1];
"ACIMSC-CreateSchemaandAddTemplate-Sub" -- Fail [color=red,
pos="423.22,359.95 439.3,351.39 455.96,339.56 466.5,324
489.24,290.42 481.5,274.55 481.5,234 481.5,234 481.5,234
481.5,162
481.5,120.71 \
475.54,109.6 458.5,72 452.5,58.75 443.25,45.25 435.5,35.063"];
"ACIMSC-AddBridgeDomaintoTemplate" -- Fail [color=red,
pos="356.37,288 391.19,278.55 426.17,266.02 436.5,252
485.39,185.63 447.55,77.845 429.6,35.692"];
VscaleACIMultisiteAddSubnettoBridgeDomain [height=0.5,
pos="244.5,234"];
"ACIMSC-AddBridgeDomaintoTemplate" --
VscaleACIMultisiteAddSubnettoBridgeDomain [color=green,
pos="266.93,287.83 262.42,277 256.7,263.29 252.17,252.41"];
VscaleACIMultisiteAddSubnettoBridgeDomain -- Fail [color=red,
pos="325.05,215.91 360.06,206.35 395.58,193.76 406.5,180
439.94,137.85 431.92,68.723 425.62,36.11"];
"ACIMSC-AddL3OuttoSiteBridgeDomain-Sub" [height=0.5,
pos="214.5,162"];
VscaleACIMultisiteAddSubnettoBridgeDomain -- "ACIMSC-
AddL3OuttoSiteBridgeDomain-Sub" [color=green,
pos="236.93,215.83 232.42,205 226.7,191.29 222.17,180.41"];
"ACIMSC-AddL3OuttoSiteBridgeDomain-Sub" -- Fail [color=red,
pos="309.72,143.87 333.49,135.88 357.57,124.41 376.5,108
398.54,88.885 410.97,56.41 416.96,36.139"];
"ACIMSC-DeployTemplatetoSites" [height=0.5,
pos="184.5,90"];
"ACIMSC-AddL3OuttoSiteBridgeDomain-Sub" -- "ACIMSC-
DeployTemplatetoSites" [color=green,
pos="206.93,143.83 202.42,133 196.7,119.29 192.17,108.41"];
"ACIMSC-DeployTemplatetoSites" -- Fail [color=red,
pos="244,71.924 290.62,57.761 353.6,38.629 390.65,27.373"];
Complete [color=white,
fillcolor="#129112",
fixedsize=false,
fontcolor=white,
height=0.5,
pos="184.5,18",
shape=oval,
width=1.3321];
"ACIMSC-DeployTemplatetoSites" -- Complete [color=green,
pos="184.5,71.831 184.5,61 184.5,47.288 184.5,36.413"];
}
答案 0 :(得分:0)
我无法渲染您的代码来获得您的图片,但是我将建议的技术仍然可以使用。
我编写了一个类似的基本示例代码:
digraph {
node [shape=rect]
a -> b -> c -> d -> e -> f
success [shape=oval]
f -> success
{
rank=max
failure [shape=oval]
}
{a b c d e f} -> failure
}
这给出了与您的问题相同的以下图片:
第一个可能的解决方案可能是向通向=false
节点的边缘添加constraint falure
属性。该属性正是这样做的-防止边缘影响布局。
digraph {
node [shape=rect]
a -> b -> c -> d -> e -> f
success [shape=oval]
f -> success
{
rank=max
failure [shape=oval]
}
{a b c d e f} -> failure [constraint=false]
}
结果:
第二种可能的解决方案是增加需要保持笔直的边缘的weight属性。重量较大的边缘往往比其他边缘更短和更直:
digraph {
node [shape=rect]
a -> b -> c -> d -> e -> f [weight=10]
success [shape=oval]
f -> success
{
rank=max
failure [shape=oval]
}
{a b c d e f} -> failure
}
结果: