cluster problem with manual positions

Hello Everybody!

I'm writing my thesis and just found graphviz a few days ago, so consider me an absolute beginner. I was able to create almost everything needed, but I do have a problem with this, not getting the cluster:

graph G {
node[shape = circle , height =.6, fixedsize= true];
i[pos="0,0"];
j[pos="80,0"];
x1[pos="160,0"];
xm[pos="290,0"];
ii[pos="370,0",label=i];
jj[pos="450,0",label=j];
subgraph cluster_0 {
x1--xm[style=dotted];
}
i--j[dir=forward];
j --x1[dir=forward];
xm--ii[dir=forward];
ii--jj[dir=forward];
}

The exact positions are not necessary, but I want horizontal alignment, and by leaving out the positions the result is vertical.
Can you help me, I hope there is a simple solution for this!
Thank you!

Regards,
galyika

AttachmentSize
cluster0.png7.5 KB

cluster problem with manual

Assuming you are using dot to do the layout, it is going to ignore the pos information. Also, an edge from A to B is going to cause B to be drawn below A. So, to get what you want, set rankdir=LR to cause a left-to-right layout rather than the default top-to-bottom. You can also simplify your graph as:

digraph G {
  rankdir=LR
  node[shape = circle , height =.6, fixedsize= true];
  ii[label=i];
  jj[label=j];
  subgraph cluster_0 {
    x1->xm[style=dotted];
  }
  i->j
  j ->x1
  xm->ii
  ii->jj
}

Recent comments