Straight edge between clusters in Graphviz

You can use this version :

digraph G { 
  subgraph cluster_X {
    A [ pos = "0,1!" ]; 
    B [ pos = "0,0!" ];
  } 
  subgraph cluster_Y {
    C [ pos = "1,1!" ]; 
    D [ pos = "1,0!" ];
  } 
  A -> B
  B -> C[label="yadda"]
  C -> D;
}

Then you use neato (not dot)

neato -Tpng -oyadda.png yadda.dot

And the result is :

enter image description here


The easiest way to achieve this is to add splines=false to the dot file - this forces the rendering of the edges to be straight lines:

digraph {
 splines=false;
 subgraph clusterX {
    A;
    B;
 }

 subgraph clusterY {
    C;
    D;
 } 

 A -> B;
 B -> C [constraint=false];
 C -> D [label=yadda];
}

Output:

graphviz output

Tags:

Graphviz