如何在GraphViz中创建两个方向的边缘?

问题描述 投票:0回答:1

如何在GraphViz中创建两个方向的边缘?

我试图用两个方向做一个弯曲的边缘。

但我能做的唯一情节是:

enter image description here

我想让x1和x2之间的边缘向两个方向弯曲。

我用过的代码:

digraph {

rankdir=LR

node [shape=box ]
x1;x2
node [shape=oval ]
y

x1->y[dir=back label=0.77]
x2->y[dir=back label=0.42]

x1:w -> x2:w[dir=both constraint=false]

}

我将不胜感激任何帮助。

graphviz dot
1个回答
0
投票

我认为应该有更好的解决方案,但以下确实对我有用:

digraph {

rankdir=LR

node [shape=box ]
x1;x2
node [shape=oval ]
y

x1->y[dir=back label=0.77]
x2->y[dir=back label=0.42]

x1:w -> x2:w[dir=both constraint=false]
x2:w -> x1:w[dir=both constraint=false]
}

根据Changing edge direction in dot的回答:

digraph g {

rankdir=LR

node [shape=box ]
{rank=same x1;x2}
node [shape=oval ]
y

x1 -> y[dir=back label=0.77]
x2 -> y[dir=back label=0.42]

x1:w -> x2:w[dir=both label=0.34]

}
© www.soinside.com 2019 - 2024. All rights reserved.