Search code examples
graphvizdot

Add space between 2 connected nodes


I would like to add a little more horizontal space between the 2 nodes so the edge labels appear associated to their node (instead of in the middle of the edge):

enter image description here

The graphviz source:

digraph {
  rankdir="LR";
  node [shape=cylinder]
  clone
  initial
  clone -> initial [headlabel="origin",taillabel="clone"]
}

Expected: enter image description here

I tried using nodesep but it seems to only work when there are no edges.


Solution

  • nodesep was a good try, but your ranking is LR, so ranksep is the way to go

    digraph {
      rankdir="LR";
      ranksep=1.2 // rank-to-rank in inches
      node [shape=cylinder]
      clone
      initial
      clone -> initial [headlabel="origin",taillabel="clone"]
    }
    

    Giving:
    enter image description here