Graphviz edge overlap

Hello,
I’m trying to render the following diagram:

digraph g {
    label="Conectividade Física"
    labelloc=t
    forcelabels=true
    graph [fontname="Helvetica"]
    graph [style=wedged colorscheme=set39]
    node [label="" shape=box fontname="Helvetica-Bold" fontsize="12pt" style=filled fillcolor="#E3FCDD:#BFF4AC" color="#336F05" gradientangle=90]
    edge [fontname="Helvetica" fontsize="10pt"]
    dummy01 [style="invis" width="0"]
    dummy02 [style="invis" width="0"]
    sx01 [label="sx01"]
    sx02 [label="sx02"]
    S1 [label="S1"]
    S2 [label="S2"]
    subgraph cluster_0 {
    LAG1 [label="LAG" width=1.2 shape=ellipse fillcolor="#FFFFFF"]
    LAG2 [label="LAG" width=1.2 shape=ellipse fillcolor="#FFFFFF"]
    }
    LAG3 [label="" width=".2" shape=ellipse fillcolor="#FFFFFF"]
    concentrate=true
    splines=line

    { rank = same; sx01 LAG3 sx02 }
    { rank = same; LAG1 LAG2 }
    { rank = same; S1 S2 }

    sx01 -> LAG3 [style=invis]
    LAG3 -> sx02 [style=invis]
    sx01 -> sx02 [peripheries=2 color="black:white:black" arrowhead=none
        labeldistance=2.5
        labelangle=0
        headlabel=<
            <table border="0">
                <tr>
                    <td>Peerlink</td>
                </tr>
                <tr><td></td></tr>
                <tr><td></td></tr>
                <tr><td></td></tr>
                <tr><td></td></tr>
                <tr><td></td></tr>
                <tr><td></td></tr>
                <tr><td></td></tr>
                <tr><td></td></tr>
                <tr><td></td></tr>
            </table>
        >
    ]
  
    sx01 -> LAG1 [style="invis"]
    LAG1 -> S2 [style="invis"]
    LAG1 -> sx02 [style="invis"]
    sx01 -> S1 [color="#1A5883" arrowhead=none labelangle=35 taillabel="" headlabel="" fontsize="8pt"]
    sx01 -> S2 [color="#00BE50" arrowhead=none labelangle=35 taillabel="" headlabel="" fontsize="8pt"]
    
    sx02 -> LAG2 [style="invis"]
    LAG2 -> S1 [style="invis"]
    LAG2 -> sx01 [style="invis"]
    sx02 -> S1 [color="#1A5883" arrowhead=none labelangle=35 taillabel="" headlabel="" fontsize="8pt"]
    sx02 -> S2 [color="#00BE50" arrowhead=none labelangle=-75 taillabel="" headlabel="" fontsize="8pt"]
    S1 -> S2 [minlen=9 style=invis arrowhead=none]
    
    LAG1 -> LAG2 [style="invis" minlen=2]
}

It’s being rendered as:

Notice that the blue arrow is traversing the “LAG1” which isn’t desired, and the blue and green arrows are touching the “server0x” on both nodes instead of outside. From what I’ve seen, it’s happening because the “splines=lines” but the graph doesn’t render as expected without it.

The example below shows that depending on Nodes size, the “LAG” isn’t aligned as expected. I would like that depending on nodes size, the “LAG” nodes crosses the blue/green lines, respectively, but I believe it’s not possible, so I did my best for the “LAG” nodes to keep crossing the lines for green nodes up to 15 characteres.

Also, I would like to know if there’s someway to resize the “LAG” or position it next to the bottom “server0X” nodes so I could use a static “width”.

In fact, what I would like to achieve is something similar to below:

If it’s not possible to add another two “LAG” nodes, it’s fine.

I’m using PlantUML to render it on a Web Page using PlantUML DokuWiki plugin, so from what I can tell, I can use only “dot” mode (I believe PlantUML doesn’t support “neato” or other modes).

Any help is appreciated.

  • outputorder=edgefirst for nodes on top of edges
  • minlen for vertical separation
  • ** group** for vertical alignment
digraph g {
  label="Conectividade Física"
  labelloc=t
  outputorder=edgefirst  // nodes on top of edges
  graph [fontname="Helvetica" splines=line ]
  graph [ranksep=.1]     // snug the lag nodes to the S? nodes

  // Note: The style "wedged" is allowed only for elliptically-shaped nodes.
  // graph [style=wedged
  // graph [ colorscheme=set39]  // not used
  node [ shape=box fontname="Helvetica-Bold" fontsize="12pt"
         style=filled fillcolor="#E3FCDD:#BFF4AC" color="#336F05" gradientangle=90]
  edge [fontname="Helvetica" fontsize="10pt" dir=none]  // added dir

  {
    rank=same;
    sx01 [label="sx01"]
    LAG3 [label=""  width=".2" shape=ellipse fillcolor="#FFFFFF"]
    sx02 [label="sx02"]
    sx01 -> LAG3 -> sx02  [ color="black:white:black"]
    LAG3:n -> LAG3:n [color=white headlabel=" Peerlink" labelangle=0 labeldistance=.6 ]
  }
  {
    rank = same;
    LAG1 [label="LAG" width=1 height=.2 shape=ellipse fillcolor="#FFFFFF" group=g1 margin=.02]
    LAG2 [label="LAG" width=1 height=.3 shape=ellipse fillcolor="#FFFFFF" group=g2 margin=.02]
    LAG1 -> LAG2 [color=white]
  }
  {
    rank = same;
    S1 [label="S1" group=g1]
    S2 [label="S2" group=g2]
    S1 -> S2 [color=white]
  }
  {
    edge [ minlen=4]
    sx01 -> S1:n [color="#1A5883"]
    sx01 -> S2:n [color="#00BE50" ]
    sx02 -> S1:n [color="#1A5883" ]
    sx02 -> S2:n [color="#00BE50" ]
  }
  edge [color=white]
  LAG1 -> S1:ne
  LAG2 -> S2:nw
}

Giving:

1 Like

Thank you for your help, it’s beautiful!