Can't reproduce the "Undirected Graph Clusters" example

I can't reproduce the "Undirected Graph Clusters" example.

http://www.graphviz.org/content/fdpclust

The link between clusters doesn't work. It create two nodes called "clusterB" and "clusterC".

graph G {
e
subgraph clusterA {
a -- b;
subgraph clusterC {
C -- D;
}
}
subgraph clusterB {
d -- f
}
d -- D
e -- clusterB
clusterC -- clusterB
}

Ubuntu: 14.04
Graphviz: 2.36

AttachmentSize
g2.png22.33 KB

You are running dot on the

You are running dot on the file; use fdp instead.

   fdp -Tpng g2.gv -o g2.png

Hi, you can achieve solution

Hi,

you can achieve solution based in "dot" tool as well.

Basically you can use "compound=true" and "lhead"/"ltail" to let edges end at cluster instead of vertex, see sample from page 27 of dotguide:
http://t.co/02C2chdNYC

I added invisible vertices to clusters in order to allow a single cluster vertex represent the cluster as head or tail for edges.

I added ranksep=1 to make crossing edges go away, see the result here:
http://t.co/fB5dRKOBmJ

For completeness the modified raw .dot file:

graph G {
compound=true ranksep=1
e
subgraph clusterA {
a -- b;
subgraph clusterC {
C -- D;
cC [style=invis]
}
}
subgraph clusterB {
d -- f
cB [style=invis]
}
d -- D
e -- cB [lhead=clusterB];
cC -- cB [ltail=clusterC,lhead=clusterB]
}

 

Hermann.

 

Recent comments