Graphviz splines=false has no effect on undirected graph with bi-directional a — b/b — a edges

StackOverflow https://stackoverflow.com/questions/10442480

  •  05-06-2021
  •  | 
  •  

Question

I am drawing an undirected graph with Graphviz that has redundant edges, (e.g. A -- B and B -- A). I would like to see only one line between the two vertices, regardless of whether there is a redundant reverse edge in the data. My question is, is there a way to do this with Graphviz, without having to use some other tool/code first to remove the redundant edges? I have tried graph [splines=false]; without any success. Below is a minimal example:

graph G {
    graph [splines=false];
    node [shape=point];
    a -- b;
    b -- a;
}

And the output:

enter image description here

What I want as output is:

enter image description here

despite the redundant edges that may exist in the specified graph.

Was it helpful?

Solution

Try "strict graph G { ... }"

A strict graph or digraph disallows parallel edges.

Stephen North north@graphviz.org

OTHER TIPS

You may try setting nodesep to 0 :

... this affects the spacing between loops on a single node, or multiedges between a pair of nodes.

Not sure if nodesep is completely set to 0, because in the documentation the minimum value indicated is 0.02. A quick test seems to be ok, though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top