28

I'd like to group some nodes with the following code

digraph dataflow {
    subgraph pipeline {
        relations;
        synonyms;
        articles;
    }
    subgraph lucene {
        index;
        search;
    }
    training_data - > index;
    relations - > search;
    synonyms - > index;
    articles - > index;
    training_data - > evaluation;
}

But dot doesn't care about the subgraphs:

example dot graph

Sibeesh Venu
  • 12,177
  • 5
  • 67
  • 98
Reactormonk
  • 20,410
  • 12
  • 66
  • 110

1 Answers1

45

Try prefixing your subgraphs with 'cluster_':

digraph dataflow {
    subgraph cluster_pipeline {
        relations;
        synonyms;
        articles;
    }
    subgraph cluster_lucene {
        index;
        search;
    }
    training_data -> index;
    relations -> search;
    synonyms -> index;
    articles -> index;
    training_data -> evaluation;
}
Rick
  • 1,317
  • 9
  • 13
  • 6
    Wow, this is it. I wanted to know more about what exactly cluster does, here is it: "a subgraph whose name begins with "cluster" is given special treatment. The subgraph is laid out separately, and then integrated as a unit into its parent graph, with a bounding rectangle drawn about it. If the cluster has a label parameter, this label is displayed within the rectangle. Note also that there can be clusters within clusters." Source: http://www.graphviz.org/doc/info/attrs.html#d:clusterrank – Paul Tobias Dec 06 '15 at 09:15