Graphviz子图无法显示 [英] Graphviz subgraph doesn't get visualized

查看:296
本文介绍了Graphviz子图无法显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个在点上包含两个子图的图.代码如下:

I'm trying to create a graph with two subgraphs in dot. The code is as follows:

digraph G {
        subgraph step1 {
                style=filled;
                node [label="Compiler"] step1_Compiler;
                node [label="Maschine"] step1_Maschine;
                color=lightgrey;
        }

        subgraph step2 {
                style=filled;
                color=lightgrey;
                node [label="Interpretierer"] step2_Interpretierer;
                node [label="Maschine"] step2_Maschine;
                label="Virtuelle Maschine";
        }

        "Programm (Java)" -> step1_Compiler;
        step1_Compiler -> step1_Maschine;
        step1_Maschine -> "Bytecode";
        "Bytecode" -> step2_Interpretierer;
        step2_Interpretierer -> step2_Maschine;
        step2_Maschine -> "Ergebnis";
}

我得到的结果如下:

我希望在两个子图的周围都看到一个方框.我在这里想念什么?

I expected to see a box around both subgraphs. What am I missing here?

推荐答案

您必须在子图的名称前加上 cluster

You'll have to prefix the name of your subgraphs with cluster:

subgraph clusterstep1 {

subgraph clusterstep2 {

以获取样式和标签.

graphiz文档的子图和群集"部分:

子图的第三个角色直接涉及该图的形式 由某些布局引擎进行布局. 子图的名称是否开头 对于群集,Graphviz将子图记为特殊群集 子图.如果支持,布局引擎将进行布局,以便 属于集群的节点被绘制在一起,整个 包含在边界矩形中的群集的图形.笔记 无论好坏,聚类子图都不是DOT的一部分 语言,但仅仅是某些人遵守的句法惯例 布局引擎.

The third role for subgraphs directly involves how the graph will be laid out by certain layout engines. If the name of the subgraph begins with cluster, Graphviz notes the subgraph as a special cluster subgraph. If supported, the layout engine will do the layout so that the nodes belonging to the cluster are drawn together, with the entire drawing of the cluster contained within a bounding rectangle. Note that, for good and bad, cluster subgraphs are not part of the DOT language, but solely a syntactic convention adhered to by certain of the layout engines.

这篇关于Graphviz子图无法显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆