Curved arrows

Is it possible to use 'curved-arrow' to connect nodes? digraph G { rankdir=LR; fontname="sans-serif"; penwidth="0.1"; edge [comment="Wildcard edge", fontname="sans-serif", fontsize=10, colorscheme="blues3", color=2, fontcolor=3]; node [fontname="serif", fontsize=13, fillcolor="1", colorscheme="blues4", color="2", fontcolor="4", style="filled"]; "a"; "b"; "a" -> "b" [dir="both"]; }

 

The same question was posted on graphviz a while ago:

https://stackoverflow.com/questions/24648791/arc-graph-layout-in-graphvi...

Far more complex, but perfectly describes what I am thinking.

What do you mean by

What do you mean by connecting nodes with a curved arrow? Can you point to an example, or explain this more fully? Thanks.

examples of curved connectors

Here are some examples:

http://www.d3noob.org/2013/03/d3js-force-directed-graph-examples.html

In dot and 'splines=curved':

1. Does not render properly. produces two edges between nodes.

2. Nodes are always fixed and lines are excessively curvy. It would be nicer to have nodes shift as in neato and the above diagrams to allow curves. I also need cluster subgraphs, so neato is not an option. FDP seems to work, but again the spline-polynomial is of a high-degree. It woul dbe nicer to force an "arc" instead of a spline.

3. On a related note, the bounding box for a subgraph is always 'tight' around the nodes.  Is it possible to keep the size (w, h) of boxes for all subgraphs to be the same? or prespecify some minimal ratio?

 

  In dot and

 

In dot and 'splines=curved':

1. Does not render properly. produces two edges between nodes.

This was a bug that has been fixed. Please install a newer version.

2. Nodes are always fixed and lines are excessively curvy. It would be nicer to have nodes shift as in neato and the above diagrams to allow curves. I also need cluster subgraphs, so neato is not an option. FDP seems to work, but again the spline-polynomial is of a high-degree. It woul dbe nicer to force an "arc" instead of a spline.

If you have a dense positioning of nodes and use splines=true, you will get fairly curvy edges. You should find that splines=curved gives you what you want, or try introducing more space with nodesep and ranksep.

3. On a related note, the bounding box for a subgraph is always 'tight' around the nodes.  Is it possible to keep the size (w, h) of boxes for all subgraphs to be the same? or prespecify some minimal ratio?

No, especially as the box size is determined by the nodes it contains. Interesting idea though.

 

splines=curved - adjacent nodes

It seems edges between adjacent nodes by definition will be a straightline! 

Is it possible to force adjacent edges to be curved?

Yes, at present, flat edges

Yes, at present, flat edges in general don't support edges as arcs. I need to fix that. A hack is to add an additional invisible edge between the nodes.

By the way, I fixed another bug in the code related to curved edges today, so you might do another update.

'invis' edge issues

There are several related issues:

  • [splines=curved] does not render self-edges a->a

g <- "digraph M {
   graph [splines=curved];
    'a';
    'b';
    'a' -> 'b' [style=invis]; 
  'a' -> 'b' [dir=both];
  'b' -> 'b' [dir=both];
}"

  • Graph is now specified as "Agstrictdirected". Additional code is required to (a) add & delete 'invis' edge when appropriate, and (b) to ensure graph integrity - to prevent duplicate edges from being inserted. (b) is less of an issue, as it adds clarity. 

Any thoughts will be greatly appreciated.  Thanks, TR

Thank you for the "invis' tip

Thank you for the "invis' tip and the update.   I will download the new version.

splines=curved

Thanks.

1. good to know.

2.  Yes, I am experimenting with sep and rank

Option to draw and "arc" instead of "spline" would bre 'really' nice. may provides a natural  mechanism for optimal spacing of nodes in certain diagrams.  

 

Recent comments