如何避免GraphViz边缘的重叠

发布于 2025-01-25 17:29:32 字数 882 浏览 1 评论 0原文

我的GraphViz如下:

digraph G { 
    node [fontname = "font-awesome"]; edge [dir=none]; 

    A [label="A"];
    B [label="B"];
    c_A_B [shape=diamond];  
    {rank=same; A -> c_A_B -> B};
 
    C [label="C"];
    L1_0 [shape=circle,label="",height=0.01,width=0.01];
    L1_0->C;
 
    D [label="D"];
    L1_1 [shape=circle,label="",height=0.01,width=0.01];
    L1_1->D;  
 
    E [label="E"];  
    L1_2 [shape=circle,label="",height=0.01,width=0.01];
    L1_2->E;
 
    {rank=same; L1_0->L1_1->L1_2};
    {rank=same;  C; D; E;};
    c_A_B->L1_1; 

    F [label="F"];
    c_E_F [shape=diamond]; 
 
    {rank=same; E->c_E_F->F};

    L2_0 [shape=circle,label="",height=0.01,width=0.01];
    c_E_F->L2_0; 
}

哪个显示图形如下,任何人都可以帮助我避免边缘重叠吗?

“在此处输入图像说明”

I have Graphviz as below:

digraph G { 
    node [fontname = "font-awesome"]; edge [dir=none]; 

    A [label="A"];
    B [label="B"];
    c_A_B [shape=diamond];  
    {rank=same; A -> c_A_B -> B};
 
    C [label="C"];
    L1_0 [shape=circle,label="",height=0.01,width=0.01];
    L1_0->C;
 
    D [label="D"];
    L1_1 [shape=circle,label="",height=0.01,width=0.01];
    L1_1->D;  
 
    E [label="E"];  
    L1_2 [shape=circle,label="",height=0.01,width=0.01];
    L1_2->E;
 
    {rank=same; L1_0->L1_1->L1_2};
    {rank=same;  C; D; E;};
    c_A_B->L1_1; 

    F [label="F"];
    c_E_F [shape=diamond]; 
 
    {rank=same; E->c_E_F->F};

    L2_0 [shape=circle,label="",height=0.01,width=0.01];
    c_E_F->L2_0; 
}

which shows the graph as below, can anyone be kind to help me how to avoid the edge overlapping?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰火雁神 2025-02-01 17:29:32

我在这种情况下,在这种情况下,解决方案可以成为以下形式的看不见的边缘:

    C -> D [style=invis];

因此您的示例看起来像:

digraph G { 
    node [fontname = "font-awesome"]; edge [dir=none]; 

    A [label="A"];
    B [label="B"];
    c_A_B [shape=diamond];  
    {rank=same; A -> c_A_B -> B};
 
    C [label="C"];
    L1_0 [shape=circle,label="",height=0.01,width=0.01];
    L1_0->C;
 
    D [label="D"];
    L1_1 [shape=circle,label="",height=0.01,width=0.01];
    L1_1->D;  

    C -> D [style=invis];

 
    E [label="E"];  
    L1_2 [shape=circle,label="",height=0.01,width=0.01];
    L1_2->E;
 
    {rank=same; L1_0->L1_1->L1_2};
    {rank=same;  C; D; E;};
    c_A_B->L1_1; 

    F [label="F"];
    c_E_F [shape=diamond]; 
 
    {rank=same; E->c_E_F->F};

    L2_0 [shape=circle,label="",height=0.01,width=0.01];
    c_E_F->L2_0; 
}

所产生的图像是:

I this case in this case a solution for you can be an invisible edge in the form of:

    C -> D [style=invis];

so your example would look like:

digraph G { 
    node [fontname = "font-awesome"]; edge [dir=none]; 

    A [label="A"];
    B [label="B"];
    c_A_B [shape=diamond];  
    {rank=same; A -> c_A_B -> B};
 
    C [label="C"];
    L1_0 [shape=circle,label="",height=0.01,width=0.01];
    L1_0->C;
 
    D [label="D"];
    L1_1 [shape=circle,label="",height=0.01,width=0.01];
    L1_1->D;  

    C -> D [style=invis];

 
    E [label="E"];  
    L1_2 [shape=circle,label="",height=0.01,width=0.01];
    L1_2->E;
 
    {rank=same; L1_0->L1_1->L1_2};
    {rank=same;  C; D; E;};
    c_A_B->L1_1; 

    F [label="F"];
    c_E_F [shape=diamond]; 
 
    {rank=same; E->c_E_F->F};

    L2_0 [shape=circle,label="",height=0.01,width=0.01];
    c_E_F->L2_0; 
}

And the resulting image is:
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文