Graphviz 子图没有可视化

发布于 2024-12-07 01:23:44 字数 945 浏览 0 评论 0原文

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

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'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";
}

The result I am getting looks like the following:

Result of above code

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

━╋う一瞬間旳綻放 2024-12-14 01:23:44

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

subgraph clusterstep1 {

subgraph clusterstep2 {

前缀,才能获取样式和标签。

来自 graphiz 文档的“子图和集群”部分

子图的第三个作用直接涉及到图的样子
由某些布局引擎布局。 如果子图的名称开始
对于簇,Graphviz 将子图标记为特殊簇
子图
。如果支持,布局引擎将进行布局,以便
属于该集群的节点被绘制在一起,整个集群
绘制包含在边界矩形内的簇。笔记
无论好坏,簇子图都不是 DOT 的一部分
语言,但仅仅是某些特定语言所遵守的句法约定
布局引擎。

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

subgraph clusterstep1 {

and

subgraph clusterstep2 {

in order to get the style and label.

From the graphiz documentation, section "Subgraphs and Clusters":

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文