Martin Alleon
Martin Alleon

Reputation: 13

Parallel edges are merged into 1 when using splines = true in graphviz

I'm using graphviz (dot) to generate an undirected multigraph where a lot of the edges are overlapping with nodes and I also have to parallel edges (2 nodes with multiple edges).

I tried to use splines = true to remove the overlap but that just made a ton of parallel edges merge into a single edge.

Here is a Picture on my graph with and without splines:

using splines = true

using splines = false

What I am looking to get would be a way to visualize the parallel edges without having to compromise with graph clarity.

I replicated this issue with a smaller graph:

using splines = true

using splines = false

Here is the dot code for this smaller graph:

graph G {
    bgcolor = grey
    layout = fdp
    outputorder = edgesfirst
    splines = false
    
    
    a [color = white, style = filled, shape = circle ]
    b [color = white, style = filled, shape = circle ]
    b [color = white, style = filled, shape = circle ]
    c [color = white, style = filled, shape = circle ]
    d [color = white, style = filled, shape = circle ]
    e [color = white, style = filled, shape = circle ]
    f [color = white, style = filled, shape = circle ]
    g [color = white, style = filled, shape = circle ]
    h [color = white, style = filled, shape = circle ];

    a--b [color=red]
    a--b [color=blue]
    a--g [color=red]
    a--f [color=blue]
    a--c [color=black]
    a--d [color=red]
    b--h [color=black]
    e--h [color=blue]
    e--d [color=black]
    e--g [color=red]
    c--f [color=black]
    c--f [color=red]
    b--d [color=blue]
    g--b [color=black]
    h--a [color=red]

Upvotes: 1

Views: 338

Answers (2)

sroush
sroush

Reputation: 6791

You are hitting a bug, introduced sometime after version 2.43.0. It seems to affect every engine except dot.
I suggest reporting this bug here: https://gitlab.com/graphviz/graphviz/-/issues.
No work-arounds found, yet.

Upvotes: 2

sroush
sroush

Reputation: 6791

  • your example graph is minimally missing a closing brace. Not sure if any nodes or edges are missing
  • your graph is actually using the fdp engine, not the dot engine layout = fdp
  • aesthetics are often in the eye of the beholder, but here are some suggestions:

Upvotes: 1

Related Questions