iterating edge control points with libgraphviz

I am using the C API to layout graph using the instructions from the guide "Drawing graphs with graphviz". After a call to gvLayout(...) I query individual nodes and edge labels to perform some custom rendering of my graph objects. All is well except I cannot find details on how to return edge control points.

If I output the graph to 'dot' format using gvRender(...) then each of the edges has a 'pos' field in the format;

pos="e,541.85,161.79 229.58,161.79 320.51,161.79 446.12,161.79 531.63,161.79"

I understand the contents of this (i.e. the first element 'e' implies end point followed by cubic B-spline control points) but cannot find any details on how to access these values from within the libgraphviz API. The closest thing I have found is a suggestion to iterate over the "edge->u.spl->list" however this is NULL for all of my edges!

Any help or pointer in the right direction would be greatly appreciated.



iterating edge control points

This should not be the case. After gvLayout(), ED_spl(e) should give something like
  list = 0x25a610, 
  size = 1, 
  bb = {
    LL = {
      x = 0, 
      y = 0
    UR = {
      x = 0, 
      y = 0
Since gvRender is producing spline information, your graph can't have splines=none or something. Any chance you are calling gvFreeLayout() before accessing the spline info? Is edge->u.spl NULL or edge->u.spl->list NULL?

Recent comments