相关疑难解决方法(0)

GraphViz - 如何连接子图?

DOT语言中GraphViz,我试图表示一个依赖关系图.我需要能够在容器内部拥有节点,并且能够使节点和/或容器依赖于其他节点和/或容器.

subgraph用来代表我的容器.节点链接工作正常,但我无法弄清楚如何连接子图.

鉴于下面的程序,我需要能够连接cluster_1cluster_2使用箭头,但我尝试过的任何东西都会创建新节点而不是连接集群:

digraph G {

    graph [fontsize=10 fontname="Verdana"];
    node [shape=record fontsize=10 fontname="Verdana"];

    subgraph cluster_0 {
        node [style=filled];
        "Item 1" "Item 2";
        label = "Container A";
        color=blue;
    }

    subgraph cluster_1 {
        node [style=filled];
        "Item 3" "Item 4";
        label = "Container B";
        color=blue;
    }

    subgraph cluster_2 {
        node [style=filled];
        "Item 5" "Item 6";
        label = "Container C";
        color=blue;
    }

    // Renders fine
    "Item 1" -> "Item 2";
    "Item 2" -> "Item …
Run Code Online (Sandbox Code Playgroud)

graphics directed-graph dot graphviz subgraph

152
推荐指数
3
解决办法
8万
查看次数

标签 统计

directed-graph ×1

dot ×1

graphics ×1

graphviz ×1

subgraph ×1