具有子图的组节点

时间:2012-07-11 13:02:33

标签: graphviz dot subgraph

我想用以下代码对某些节点进行分组

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

但是dot并不关心子图:

example dot graph

1 个答案:

答案 0 :(得分:30)

尝试使用'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;
}