Search code examples
graphviz

How to specify the length of an edge in graphviz?


In a directed graph, if there is a cycle, the graphviz makes that edge really short.

Is there a parameter that would let me change the length of the cyclic edge, so that the graph looks a bit uniform.

digraph ER {
  rankdir="LR";
  //orientation=landscape;
    node [shape=ellipse, fontsize=30];
  {node [label="Original"] old;}
  {node [label="Final"] new;}
  {node [label="Intermediate"] ir;}

old -> ir [label="suggest", fontsize=30];
ir -> ir [label="validate", fontsize=30, len=f];
ir -> new [label = "finalize", fontsize=30];
}

enter image description here


Solution

  • I found that the following attribute nodesep worked to solve this problem with sfdp.

    From nodesep | Graphviz:

    For layouts other than dot

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

    Note that this is a graph attribute, so the value is the same for all edges in the graph.