Graphviz Clusters

The fdp layout program supports edges between nodes and clusters and cluster-to-cluster. To make edges with clusters as endpoints, fdp relies on the convention that both nodes and cluster subgraphs have identifical names with the prefix cluster, as in the example. graphviz

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

I was worried that they were saying small-a node and capital-A cluster were somehow related. So I renamed the clusters X, Y and Z with no change in the diagram.

graph { layout=fdp e subgraph clusterX { a -- b; subgraph clusterZ { C -- D; } } subgraph clusterY { d -- f } d -- D e -- clusterY clusterZ -- clusterY }

graph {
  e
  subgraph clusterX {
    a -- b;
    subgraph clusterZ {
      C -- D;
    }
  }
  subgraph clusterY {
    d -- f
  }
  d -- D
  e -- clusterY
  clusterZ -- clusterY
}

Node:e Node:a links Node:b parent Cluster:X Node:b parent Cluster:X Node:C links Node:D parent Cluster:Z Node:D parent Cluster:Z Cluster:Z parent Cluster:X Node:d links Node:f parent Cluster:Y Node:f parent Cluster:Y Node:d links Node:D Node:e links Cluster:Y Cluster:Z links Cluster:Y

digraph { node [shape=box style=filled fillcolor=bisque] 3 6 9 node[fillcolor=palegreen] 0 [label="Node\ne"] 1 [label="Node\na"] 2 [label="Node\nb"] 3 [label="Cluster\nX"] 4 [label="Node\nC"] 5 [label="Node\nD"] 6 [label="Cluster\nZ"] 7 [label="Node\nd"] 8 [label="Node\nf"] 9 [label="Cluster\nY"] 1 -> 2 [label="Links"] 1 -> 3 [label="Parent"] 2 -> 3 [label="Parent"] 4 -> 5 [label="Links"] 4 -> 6 [label="Parent"] 5 -> 6 [label="Parent"] 6 -> 3 [label="Parent"] 7 -> 8 [label="Links"] 7 -> 9 [label="Parent"] 8 -> 9 [label="Parent"] 7 -> 5 [label="Links"] 0 -> 9 [label="Links"] 6 -> 9 [label="Links"] }

http://ward.dojo.fed.wiki/assets/pages/mock-graph-data/freeform.html HEIGHT 300

.

We did this translation by hand but note that once an encoding has been chosen some automation is possible. See Import Dot Graphs