views:

250

answers:

1

Hi,

I have dot (graphviz) file with given graph which consist several nodes and edges.
I would like to create a copy of that graph and cluster cluster (group) few nodes together.
However whenever I am doing that the layout of the graph is changing (adopting to the cluster).

Is there any way I could fix the position of the graph and then add clustering?

Thanks.

+2  A: 

If for instance, you want to show a "before and after" (one graph w/out the cluster and one with), it might be easiest to initially create both graphs with the clusters (so that they look identical). Then for the graph that you want "unclustered", set all of the subgraph parameters so that the cluster annotations are invisible--i.e., with no cluster label and with a color that is the same as the background color of your graph. the cluster will appear invisible.

So for instance, in the code below, the cluster will appear invisible:

subgraph cluster_inv {
  node [style=filled];
  N1 -> N2 -> N3;
  label="";
  color="#FFFFFF";
}
doug
name