gpt4 book ai didi

graphviz - Graphviz DOT 文件中的多个图形

转载 作者:行者123 更新时间:2023-12-05 01:34:17 26 4
gpt4 key购买 nike

我有这个 Graphviz DOT 图:

digraph unit_test {
label="Unit test"

edge [fillcolor="#a6cee3" color="#1f78b4"]

node[shape="ellipse" style="filled" fillcolor="#1f77b4"]
start
end
node[shape="box" style="filled" fillcolor="#ff7f0e"]
process

subgraph cluster_process {
label = "Major logic"
process
}

start -> process
process -> end

}

以上呈现为:

First graph

我有第二张图:

digraph details {
label = "Process details"

edge [fillcolor="#a6cee3" color="#1f78b4"]

node[shape="ellipse" style="filled" fillcolor="#1f77b4"]
start
end
node[shape="box" style="filled" fillcolor="#ff7f0e"]
details

subgraph cluster_details {
label = "Details"
details
}

start -> details
details -> end
}

渲染到:

Second graph

问题

当我将以上两个图表放入同一个名为 supporting.dot 的 DOT 文件中并运行 dot -Tpng -o supporting.png supporting.dot 命令时,终端打印出一些胡言乱语,输出图像文件不会包含两个图形,它只包含第一个。是否可以在单个 DOT 文件中使用多个图形?如果是这样,我错过了什么?

Terminal output

最佳答案

问题不清楚要完成什么,但也许以下是一个起点

digraph G{
subgraph unit_test {
label="Unit test"

edge [fillcolor="#a6cee3" color="#1f78b4"]

node[shape="ellipse" style="filled" fillcolor="#1f77b4"]
start
end
node[shape="box" style="filled" fillcolor="#ff7f0e"]
process

subgraph cluster_process {
label = "Major logic"
process
}

start -> process
process -> end

}

subgraph details {
label = "Process details"

edge [fillcolor="#a6cee3" color="#1f78b4"]

node[shape="ellipse" style="filled" fillcolor="#1f77b4"]
start1 [label="start"]
end1 [label="end"]
node[shape="box" style="filled" fillcolor="#ff7f0e"]
details

subgraph cluster_details {
label = "Details"
details
}

start1 -> details
details -> end1
}

}

注意第二个子图中的命名/标签。

关于graphviz - Graphviz DOT 文件中的多个图形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63869676/

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