0

有人能告诉我这是哪种语言以及我应该如何将其编译成图表吗?我下载了一个python代码,执行后它给了我这个。除了输出是一个点文件之外,文档中没有任何内容。

digraph pn {
rankdir=LR;
"e" -> "P((('e', 'c'), ('d',)))";
"e" [shape=box];
"P((('e', 'c'), ('d',)))" [shape=circle];
"c" -> "P((('e', 'c'), ('d',)))";
"c" [shape=box];
"P((('e', 'c'), ('d',)))" [shape=circle];
"P((('e', 'c'), ('d',)))" -> "d";
"d" [shape=box];
"a" -> "P((('a',), ('e', 'c')))";
"a" [shape=box];
"P((('a',), ('e', 'c')))" [shape=circle];
"P((('a',), ('e', 'c')))" -> "e";
"e" [shape=box];
"P((('a',), ('e', 'c')))" -> "c";
"c" [shape=box];
"e" -> "P((('e', 'b'), ('d',)))";
"e" [shape=box];
"P((('e', 'b'), ('d',)))" [shape=circle];
"b" -> "P((('e', 'b'), ('d',)))";
"b" [shape=box];
"P((('e', 'b'), ('d',)))" [shape=circle];
"P((('e', 'b'), ('d',)))" -> "d";
"d" [shape=box];
"a" -> "P((('a',), ('e', 'b')))";
"a" [shape=box];
"P((('a',), ('e', 'b')))" [shape=circle];
"P((('a',), ('e', 'b')))" -> "e";
"e" [shape=box];
"P((('a',), ('e', 'b')))" -> "b";
"b" [shape=box];
in -> "a";
"d" -> out ;
}

4

1 回答 1

0

正如 Tim Roberts 所指出的,这绝对是一个graphviz DOT 文件。话虽如此,这成为一个重复的问题。对您的问题的简短回答变成使用来自 graphviz 的 Source 来查看您的 DOT 文件。

from graphviz import Source
filecontents="""
digraph pn {
rankdir=LR;
"e" -> "P((('e', 'c'), ('d',)))";
...
"d" -> out ;
}
"""
graphdot= Source(filecontents, filename="filename.gv", format="png")
graphdot.view()

更多关于来源的信息在这里

希望这可以帮助。快乐编码!

于 2022-02-17T22:18:09.897 回答