group nodes with subgraphs
Asked Answered
S

1

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

Sutter answered 11/7, 2012 at 13:2 Comment(0)
C
55

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;
}
Carrew answered 11/7, 2012 at 14:43 Comment(1)
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: graphviz.org/doc/info/attrs.html#d:clusterrankEbonyeboracum

© 2022 - 2024 — McMap. All rights reserved.