我正在尝试为家庭作业问题制作一个点脚本生成器,它很顺利,除了我有这个问题,其中一些未在子图中定义的节点被放置在它们中。例如,以下点脚本:
digraph dg {
compound=true;
labelloc="t";
label="test.cpp";
Vehicle;
Make;
subgraph clusterFord {
label="Ford"
Ford[shape="none"][style="invis"][label=""];
Mustang -> Vehicle [label="private"];
Thunderbird -> Vehicle [label="private"];
}
Ford -> Make [label="public"][ltail ="clusterFord"];
subgraph clusterChevrolet {
label="Chevrolet"
Chevrolet[shape="none"][style="invis"][label=""];
Camero -> Vehicle [label="private"];
}
Chevrolet -> Make [label="public"][ltail ="clusterChevrolet"];
}
生成此image:
"车辆"节点应该在"福特"之外。 subrgraph。我在这里缺少什么?
答案 0 :(得分:1)
这将给你想要的东西:
digraph dg {
compound=true;
labelloc="t";
label="test.cpp";
subgraph clusterFord {
label="Ford"
Ford[shape="none"][style="invis"][label=""];
Mustang
Thunderbird
}
subgraph clusterChevrolet {
label="Chevrolet"
Chevrolet[shape="none"][style="invis"][label=""];
Camero
}
Ford -> Make [label="public"][ltail ="clusterFord"];
Chevrolet -> Make [label="public"][ltail ="clusterChevrolet"];
Mustang -> Vehicle [label="private"];
Thunderbird -> Vehicle [label="private"];
Camero -> Vehicle [label="private"];
}