30

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
  • 18,755
  • 12
  • 103
  • 140
Reactormonk
  • 21,472
  • 14
  • 74
  • 123

1 Answers1

53

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,537
  • 11
  • 15
  • 8
    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