tags:

views:

211

answers:

2

Hi,

digraph G {
  a -> b [ label = "foo" ];
  a -> b [ label = "bar" ];
}

This will create two edges between 'a' and 'b' nodes. Is there a way to have only one edge (group them)? Thanks

+2  A: 

I think it really depends on what your desired output would be. One possibility is:

digraph G {
   graph [ splines = false ]
   a -> b [ label = "foo" ];
   a -> b [ label = "bar" ];
 }

Where not using splines draws edges with straight line segments and so duplicate edges will not be distinguished visually.

In your ideal output, what would the single edge look like since there are to be two different labels for it?

RTBarnard
Thx for the answer. It really visually is not distinguished. With labels I would like to concatenate them. I will probably have to write again the file with modifications.
name
You're correct. Your objective goes beyond the node/edge processing capabilities of graphviz and does require some sort of pre-processing to merge duplicates into the form you're looking for. Of course, with smaller graphs like the example, you can sort of fake it with the splines option.
RTBarnard
A: 

The "strict" keyword may help you.

strict digraph G {
  a -> b [ label = "foo" ];
  a -> b [ label = "bar" ];
}

This will combine the edges. But I believe it will only apply the first label.

Jason