Graphviz 警告:cmd->;barbar:头部不在头部群集\u 0内

Graphviz 警告:cmd->;barbar:头部不在头部群集\u 0内,graphviz,Graphviz,我知道,在graphviz中,如果我将composite设置为true,我就能够将一个组件连接到一个子图,而不是它的第一个元素 我的代码是: compound=true; cmd[shape=component,label="foo"]; barbar[label="bar"]; msg[label="msg"]; subgraph cluster_0 { style=filled; color=lightgrey; node [style=f

我知道,在graphviz中,如果我将
composite
设置为
true
,我就能够将一个组件连接到一个子图,而不是它的第一个元素

我的代码是:

compound=true;
cmd[shape=component,label="foo"];
barbar[label="bar"];
msg[label="msg"];


subgraph cluster_0 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        msg;
        label = "Instance.alertInstanceBingoChange()";
    }

cmd->barbar->msg[lhead=cluster_0];

因此,正如您所看到的,它提供了我想要的确切结果,除了警告之外,
barbar:head不在head cluster\u 0内


我该如何解决这个问题呢?

你很接近了。你需要做的改变很简单。只需将最后一条语句分为两条:

digraph test {
compound=true;
cmd[shape=component,label="foo"];
barbar[label="bar"];
msg[label="msg"];

subgraph cluster_0 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        msg;
        label = "Instance.alertInstanceBingoChange()";
    }

cmd->barbar;
barbar->msg[lhead=cluster_0];
}
现在,我不知道为什么会有不同,但这只是DOT的一个特点。上述语法不会产生任何警告。希望这对你有帮助:)