【发布时间】:2018-04-20 23:06:19
【问题描述】:
我想创建一个看起来像这样的图表,我。 e.其中一条边从节点Manufacturer of means of production 到具有相同名称的子图。
我为此编写了以下代码:
digraph G {
rankdir=LR;
compound=true;
graph [fontname="Liberation Mono"];
node [fontname="Liberation Mono"];
edge [fontname="Liberation Mono"];
subgraph cluster0 {
label="System components";
mmp [label="Manufacturer of means of production", shape=box];
}
subgraph cluster1 {
t1start [label="Start of tact 1", shape=point]
t1end [label="End of tact 1", shape=point ]
subgraph cluster1_mmp {
label="Manufacturer of means of production"
cluster1_1 [label="Node 1", color=white]
subgraph cluster1_1_1 {
label="Technological cycle 1"
cluster1_1_1 [label="Node 2", color=white]
}
subgraph cluster1_1_2 {
label="Technological cycle 2"
cluster1_1_2 [label="Node 2", color=white]
}
}
}
subgraph cluster2 {
label="Такт 2"
t2start [label="Start of tact 2", shape=point]
t2end [label="End of tact 2", shape=point]
}
t1end -> t2start
mmp -> cluster1_1 [ltail=cluster1_mmp];
}
如果我尝试编译此代码 ("C:\Program Files (x86)\Graphviz2.38\bin\"dot.exe -Tpng -ograph.png graph.dot),我会收到警告 Warning: mmp -> cluster1_1: tail not inside tail cluster cluster1_mmp。
我怎样才能修复它并使边缘进入子图?
更新 1:
您可以在下面找到预期结果的图像——从节点到子图(子图,而不是子图中的节点)的边。下图中这条边是红色的。
更新 2:更改代码如下所示。
digraph G {
rankdir=LR;
compound=true;
graph [fontname="Liberation Mono"];
node [fontname="Liberation Mono"];
edge [fontname="Liberation Mono"];
subgraph cluster0 {
label="System components";
mmp [label="Manufacturer of means of production", shape=box];
}
subgraph cluster1 {
t1start [label="Start of tact 1", shape=point]
t1end [label="End of tact 1", shape=point ]
subgraph cluster1_mmp {
label="Manufacturer of means of production"
testNode [label="Node 1", color=white]
subgraph cluster1_1_1 {
label="Technological cycle 1"
cluster1_1_1 [label="Node 2", color=white]
}
subgraph cluster1_1_2 {
label="Technological cycle 2"
cluster1_1_2 [label="Node 2", color=white]
}
}
}
subgraph cluster2 {
label="Такт 2"
t2start [label="Start of tact 2", shape=point]
t2end [label="End of tact 2", shape=point]
}
t1end -> t2start
mmp -> cluster1 [ltail=cluster0, lhead=cluster1, label=" "];
}
【问题讨论】:
-
您能用红色线条显示您的期望吗?我有点不清楚
-
查看更新 1。我想要一条边从节点到子图。
-
您是否尝试过使用
mmp -> cluster1_1_2 [lhead=cluster1]而不是mmp -> cluster1_1 [ltail=cluster1_mmp];?我相信它应该可以完成这项工作 -
如果你忘记了(像我一样)
compound=true;