Need help with placing boxes around nodes in fdp

I have the following code:
digraph finiteStateMachine {
graph [ fontsize = 9, rankdir = LR ]
node [ fontsize = 9, shape = circle ]
edge [ fontsize = 9 ]

S0 [ pos = "0,2!" ]
S1 [ pos = "2,2!" ]
S2 [ pos = "4,2!" ]
S3 [ pos = "2,0!",
style = "filled", color = "red", fontcolor = "white" ]
S4 [ pos = "6,2!" ]
S5 [ pos = "8,2!",
style = "filled", color = "red", fontcolor = "white" ]
S6 [ pos = "14,2!" ]
S7 [ pos = "10,6!" ]
S9 [ pos = "2,4!",
style = "filled", color = "red", fontcolor = "white" ]
S12 [ pos = "10,4!" ]
S13 [ pos = "10,2!",
style = "filled", color = "red", fontcolor = "white" ]
S14 [ pos = "10,0!" ]
S15 [ pos = "12,0!" ]
S16 [ pos = "14,0!",
style = "filled", color = "red", fontcolor = "white" ]
S17 [ pos = "14,4!" ]
S18 [ pos = "14,6!",
style = "filled", color = "red", fontcolor = "white" ]

S0 -> S1
S1 -> S2
S2 -> S4
S4 -> S5
S4 -> S5

S1 -> S3
S1 -> S9

S5 -> S14
S14 -> S15
S15 -> S16
S15 -> S16

S5 -> S7
S7 -> S12
S12 -> S13

S13 -> S14

S16 -> S7

S16 -> S6
S6 -> S17
S17 -> S18
S17 -> S18

S18 -> S7

subgraph cluster_ng {
label = "Niet Gebruikt"
color = blue

S8 [ pos = "0,0!", style = "filled" ]
S10 [ pos = "2,0!", style = "filled" ]
S11 [ pos = "4,0!", style = "filled" ]

{ rank = same; S8, S10, S11 }
}

}

This works fairly good, but I would like the box wuth S8, S10 and S11 place at the left top. I also want boxes around the sequences:
- S2, S4 and S5
- S14, S15 and S16
- S6, s17 and S18
- S7, S12 and S13

How would I do this?

There is a bug in neato that

There is a bug in neato that prevents this from being totally trivial. To get what you want, start with your graph ff.gv and

  1. Change the y coordinates of the nodes in cluster_ng to 6.
  2. Wrap your triplets in clusters. For example, subgraph cluster_0 {  S2 S4 S5 }
  3. Remove the rank=same subgraph - it has no effect
  4. Run neato ff.gv | gvpr -c -fx.g | neato -n2 -Tpdf > out.pdf where x.g is a file containing

BEG_G {
  graph_t sg = subg($,"cluster_ng");
  string ll = llOf(sg.bb);
  string urx = xOf(urOf(sg.bb));
  string ury = yOf(urOf(sg.bb));
  sg.bb = sprintf("%s,%s,%d",ll,urx,20+(int)ury);
  sg.lp = "";
}

 

Recent comments