cluster_1 is perceived in that context as a new node instead of the cluster labeled process #2.
Is there a way to have a node point to a cluster, without having it point to a node in that cluster? The emphasized part is important because I just know that a node points to a cluster, (and not a node in that cluster).
In other words, I cannot do, for instance,
a3 -> b0 [lhead=cluster_1];
(because that requires me to know that b0 is part of cluster_1)
Below is a (very lightly tested) gvpr (part of the Graphviz bundle) (see http://www.graphviz.org/pdf/gvpr.1.pdf) program that will take an input file containing edges with clusters as head and/or tail and produce a modified result, suitable for input into dot, with compound=true and each cluster-involved edge recreated as an edge to/from one of the nodes contained within the cluster.
The gvpr program:
BEGIN{
graph_t aGraph, Root, Parent[];
node_t aNode, newH, newT, theKid[], kid[];
edge_t newE, anEdge;
int i, K, clust[], Clust[], rankCnt[], maxRnk[], deleteE[], deleteN[];
graph_t graphTraverse(graph_t thisG){
for (aGraph = fstsubg(thisG); aGraph; aGraph = nxtsubg(aGraph)) {
//print ("// graph: >", aGraph.name,"<");
if (match(aGraph.name,"cluster")==0 || (hasAttr(aGraph, "cluster") && aGraph.cluster=="true")){
clust[aGraph.name]=1; // ?????
Clust[aGraph]=1;
print ("// CLUSTER ",aGraph.name);
K=0;
for (aNode=fstnode(aGraph);aNode;aNode = nxtnode_sg(aGraph, aNode)){
Parent[aNode]=aGraph;
kid[++K]=aNode;
}
i=(int)(K/2); // or we could randomize??
theKid[aGraph]=kid[i];
}
aGraph = graphTraverse(aGraph);
}
return thisG;
} // end of graphTraverse
}
BEG_G {
Root=$G;
graphTraverse ($G);
}
E{
print("// ", $.name);
if (clust[$.head.name]==0 && clust[$.tail.name]==0) continue;
newH=$.head;
newT=$.tail;
if (clust[$.head.name]==1){
print ("// BINGO - head ",$.head.name);
$G.compound="true";
deleteE[$]=1;
newH=theKid[$.head];
}
if (clust[$.tail.name]==1){
print ("// BINGO - tail ",$.tail.name);
$G.compound="true";
deleteE[$]=1;
newT=theKid[$.tail];
}
print("// NEW: ", newT.name, " ", newH.name);
newE=edge(newT, newH,"");
copyA($, newE);
if (newT != $.tail){
newE.ltail=$.tail.name;
deleteN[$.tail]=1;
}
if (newH != $.head){
newE.lhead=$.head.name;
deleteN[$.head]=1;
}
//delete($G, $);
}
END_G{
for (deleteE[anEdge]) delete(Root, anEdge);
for (deleteN[aNode]) delete(Root, aNode);
}
The (Linux) commandline (Windows should be similar?): gvpr -cf clusterCluster.gvpr myFile.gv | dot -Tpng >myFile.png
Giving: