gpt4 book ai didi

dot - Graphviz Dot 将节点放置在子图中,即使它是在其他地方定义的

转载 作者:行者123 更新时间:2023-12-03 20:20:58 30 4
gpt4 key购买 nike

我正在尝试为作业问题制作一个点脚本生成器,它进行得很顺利,但我遇到了这个问题,其中一些未在子图中定义的节点被放置在其中。例如以下点脚本:

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 :
enter image description here

“车辆”节点应该在“福特”子图之外。我在这里缺少什么?

最佳答案

这会给你想要的:

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

关于dot - Graphviz Dot 将节点放置在子图中,即使它是在其他地方定义的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23255271/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com