1

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.

4

2 回答 2

3

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.

于 2012-05-04T06:30:26.593 回答
1

Try "strict graph G { ... }"

A strict graph or digraph disallows parallel edges.

Stephen North north@graphviz.org

于 2012-05-08T15:07:41.320 回答