Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 有某种XML/Json文件要编译成Graphiz/Finite State Automaton。有什么建议吗?_Python_Turing Machines_Depth First Search_Automata - Fatal编程技术网

Python 有某种XML/Json文件要编译成Graphiz/Finite State Automaton。有什么建议吗?

Python 有某种XML/Json文件要编译成Graphiz/Finite State Automaton。有什么建议吗?,python,turing-machines,depth-first-search,automata,Python,Turing Machines,Depth First Search,Automata,我有一项任务,我需要拍摄一些现有的图片[显示一些自动机(DFA、NFA、图灵机)],并以某种方式将它们转换成一种格式,这使我能够使用数据将其表示为自动机,并将其编译成某种图形表示。你们中有人做过类似的事情吗?是否有任何Python库/框架可以让我以图形方式呈现一些自动机数据?Graphviz可以提供一个解决方案。从图中可以看出,有向无环图(DAG)的数据表示是直接而简单的。如果你像你的评论所建议的那样用手来做,它可以很容易地从图表上“读出”。复杂图的表示法(下面列出了几个不同的面板,每个面板都包

我有一项任务,我需要拍摄一些现有的图片[显示一些自动机(DFA、NFA、图灵机)],并以某种方式将它们转换成一种格式,这使我能够使用数据将其表示为自动机,并将其编译成某种图形表示。你们中有人做过类似的事情吗?是否有任何Python库/框架可以让我以图形方式呈现一些自动机数据?

Graphviz可以提供一个解决方案。从图中可以看出,有向无环图(DAG)的数据表示是直接而简单的。如果你像你的评论所建议的那样用手来做,它可以很容易地从图表上“读出”。复杂图的表示法(下面列出了几个不同的面板,每个面板都包含一个独立的DAG。正如@Constantin所说,DFA和NFA可以表示为DAG。我不确定图灵机器使用什么符号,但可以以类似的方式读取几种结构图,例如树结构;无向图。我还附上一份结果副本.dot文件的各行是您正在查找的数据项

    Digraph {
graph [label="Problem Frame\nmapping editor\n",labelloc=t,fontsize=18,compound=true];
node[shape = record,fontsize = 10];
edge[arrowtail=none,arrowhead=none,arrowsize=0.8,color=ivory4,fontsize=8];

subgraph "cluster0" {
graph [label = "Model Fragment"];
A01 [label = "{Domain|class::marking\lisTemplate::boolean default false\lname::name\ltype::domain type\l}"];
A02 [label = "{Requirement|isTemplate::boolean default false\lname::name\l}"];
A03 [label = "{Requirement Reference\n\<\<associative\>\>|content::name\lis template::boolean default false\ltype::requirement reference type\l}",shape=Mrecord,style=dotted];
A04 [label = "{Shared Phenomena Set\n\<\<associative\>\>|content::name\lis template::boolean default false\ltype::phenomena type\l}",shape=Mrecord,style=dotted];

/* 1:1-0:M */
edge[dir=both,arrowhead=crowodot,arrowtail=none];
A01 -> A03 [style=dashed];
A01 -> A04 [style = dashed];
A01 -> A04 [style = dashed];
A02 -> A03 [style = dashed];
}

subgraph "cluster1" {
graph [label = "\>\>\>",fontsize = 24];
B01 [label = "{Domain}"];
B02 [label = "{Requirement}"];
B03 [label = "{Requirement\nReference\n}",shape=Mrecord,style=dotted];
B04 [label = "{Shared\nPhenomena\nSet\n}",shape=Mrecord,style=dotted];
F01 [label = "{C0001|if \[-\> controls -\> describes.isTemplate\]\l}"];
F02 [label = "{C0002|if not \[-\> controls -\> describes.isTemplate\]\l}"];
F03 [label = "{C0003|if \[-\> controls -\> describes.type = designed\]\l}"];
F04 [label = "{C0004|if \[-\> controls -\> describes.type = given\]\l}"];
F05 [label = "{C0005|if \[-\> controls -\> describes.type = machine\]\l}"];
F06 [label = "{C0006|if \[-\> controls -\> describes.marking = biddable\]\l}"];
F07 [label = "{C0007|if \[-\> controls -\> describes.marking = causal\]\l}"];
F08 [label = "{C0008|if \[-\> controls -\> describes.marking = lexical\]\l}"];
F09 [label = "{C0009|if \[-\> controls -\> describes.marking = null\]\l}"];
F10 [label = "{C0010|if \[-\> controls -\> describes.isTemplate\]\l}"];
F11 [label = "{C0011|if not \[-\> controls -\> describes.isTemplate\]\l}"];
F12 [label = "{C0012|if \[-\> controls -\> describes.isTemplate\]\l}"];
F13 [label = "{C0013|if not \[-\> controls -\> describes.isTemplate\]\l}"];
F14 [label = "{C0014|if \[-\> controls -\> describes.type = non-constraining\]\l}"];
F15 [label = "{C0015|if not \[-\> controls -\> describes.type = constraining\]\l}"];
F16 [label = "{C0016|if \[-\> controls -\> describes.isTemplate\]\l}"];
F17 [label = "{C0017|if not \[-\> controls -\> describes.isTemplate\]\l}"];
F18 [label = "{C0018|if \[-\> controls -\> describes.type = causal\]\l}"];
F19 [label = "{C0019|if \[-\> controls -\> describes.type = event\]\l}"];
F20 [label = "{C0020|if \[-\> controls -\> describes.type = symbolic\]\l}"];

edge [style = solid];
B01 -> F01 -> F02 -> F03 -> F04 -> F05 -> F06 -> F07 -> F08 -> F09;
B02 -> F10 -> F11;
B03 -> F12 -> F13 -> F14 -> F15;
B04 -> F16 -> F17 -> F18 -> F19 -> F20;

edge [style = invis];
B01 -> B02 -> B03 -> B04;
}

subgraph "cluster2" {
graph [label = "\<\<\<",fontsize = 24];
C01 [label = "{Edge|name := Constraining Reference\larrowtail := normal\ldir := both\lpermitted node1 := domain icon\lpermitted node2 := requirement icon\lstyle := dotted\l}"];
D02 [label = "{Attribute|name::oName\lvalue::-\> describes\l-\> described by.content\l}"];
C02 [label = "{Diagram|name := Frame Diagram\l}"];
C03 [label = "{Node|name := Domain Icon\lcolor = gray\lfillcolor = gold\lfontsize := 12\llabel := describes.preLabel\l + oName + describes.postLabel\lshape := Mrecord\lstyle := filled\l}"];
D03 [label = "{Attribute|name::oClass\lvalue :=-\> describes\l-\> described by.class\l}"];
D04 [label = "{Attribute|name::oName\lvalue := -\> describes\l-\> described by.name\l}"];
D05 [label = "{Attribute|name::postlabel\lvalue := \}\"\l}"];
D06 [label = "{Attribute|name::postlabel\lvalue := \|\{\|b\}\}\"\l}"];
D07 [label = "{Attribute|name::postlabel\lvalue := \|\{\|c\}\}\"\l}"];
D08 [label = "{Attribute|name::postlabel\lvalue := \|\{\|x\}\}\"\l}"];
D09 [label = "{Attribute|name::prelabel\lvalue := \"\{\|\l}"];
D10 [label = "{Attribute|name::prelabel\lvalue := \"\{\l}"];
D11 [label = "{Attribute|name::prelabel\lvalue := \"\{\|\|\l}"];
D12 [label = "{Attribute|name::oType\lvalue := -\> describes \l-\> described by.type\l}"];
C04 [label = "{Holding Box|name := Domain Template\lcolor := slategray\lfillcolor := white\lfontcolor := slategray\lfontsize := 9\llabel := oName\lreadonly := true\l}"];
D13 [label = "{Attribute|name::oName\lvalue := -\> describes \l-\> described by.name\l}"];
C05 [label = "{Edge|name := Edge Template\lcolor := white\llabel = oName\lstyle := invis\l}"];
D14 [label = "{Attribute|name::oName\lvalue := -\> describes \l-\> described by.contents\l}"];
C06 [label = "{Node|name := Phenomena\l}"];
D15 [label = "{Attribute|name::oName\lvalue::-\> describes\l\-\> described by.contents\l}"];
C07 [label = "{Edge|name := Reference\l}"];
D16 [label = "{Attribute|name::oName\lvalue := -\> describes \l-\> described by.contents\l}"];
C08 [label = "{Node|name := Requirement Icon\l}"];
D17 [label = "{Attribute|name::oName\lvalue := -\> describes \l-\> described by.name\l}"];
C09 [label = "{Edge|name := Shared Phenomena\l}"];
D18 [label = "{Attribute|name::oName\lvalue := -\> describes \l-\> described by.contents\l}"];
D19 [label = "{Attribute|name::oType\lvalue := C\l}"];
D20 [label = "{Attribute|name::oType\lvalue := E\l}"];
D21 [label = "{Attribute|name::oType\lvalue := Y\l}"];

C01 -> D02;
C03 -> D03 -> D04 -> D05 -> D06 -> D07 -> D08 -> D09 -> D10 -> D11 -> D12;
C04 -> D13;
C05 -> D14;
C06 -> D15;
C07 -> D16;
C08 -> D17;
C09 -> D18 -> D19 -> D20 -> D21;

edge[style="invis"];
C01 -> C02 -> C03 -> C04 -> C05 -> C06 -> C07 -> C08 -> C09;
}

subgraph "cluster5" {
graph [label = "Editor Elements"];
E01 [label = "{Node\n|color::color\lfillcolor::fillcolor\lfontname::font\lfontsize::fontsize\llabel::name\lname::name\lreadonly::boolean default false\lshape::shape\lstyle::style\l}"];
E02 [label = "{Edge\n|arrowtail::edge end\ldir::dir\lname::name\lpermitted node1::name\lpermitted node2::name\lstyle::style\l}"];
E03 [label = "{Attribute\n|name::name\lvalue::text\l}"];
E04 [label = "{Diagram\n|defaults::attributes\ledge defaults::attributes\lname::name\lnode attributes::attributes\l}"];
E05 [label = "{Holding Box|color::color\lfillcolor::fillcolor\lfontname::font\lfontsize::fontsize\llabel::name\lname::name\lreadonly::boolean default false\lshape::shape\lstyle::style\l}"];

/* 0:1-N:M */
E01 -> E02 [arrowhead = crowodot, label = "links", taillabel = " 2:2"];

/* 1:1-0:M  */
edge[dir=both,arrowtail=none,arrowhead=crowodot];
E04 -> E01 [label = nodes];
E04 -> E02 [label = edges];
E04 -> E05 [label = "holding boxes"];

/* 0:1-0:M  */
edge[dir=both,arrowtail=odot,arrowhead=crowodot];
E05 -> E01 [label = "contained nodes"];
E05 -> E02 [label = "contained edges"];
E05 -> E05 [label = contains];

/* 0:1-0:M  */
edge[dir=both,arrowtail=odot,arrowhead=crowodot];
E01 -> E03 [label = characteristics];
E02 -> E03 [label = parameters];
E04 -> E03 [label = attributes];
E04 -> E03 [label = attributes];
E04 -> E03 [label = attributes];
}

{rank = min B01 C01}

edge[style="solid"];
F01 -> C04 [ltail = cluster1];
F02 -> C03 [ltail = cluster1];
F03 -> D09 [ltail = cluster1];
F04 -> D10 [ltail = cluster1];
F05 -> D11 [ltail = cluster1];
F06 -> D06 [ltail = cluster1];
F07 -> D07 [ltail = cluster1];
F08 -> D08 [ltail = cluster1];
F09 -> D05 [ltail = cluster1];
F10 -> C04 [ltail = cluster1];
F11 -> C06 [ltail = cluster1];
F11 -> C08 [ltail = cluster1];
F12 -> C05 [ltail = cluster1];
F14 -> C07 [ltail = cluster1];
F15 -> C01 [ltail = cluster1];
F16 -> C05 [ltail = cluster1];
F17 -> C06 [ltail = cluster1];
F17 -> C09 [ltail = cluster1];
F18 -> D19 [ltail = cluster1];
F19 -> D20 [ltail = cluster1];
F20 -> D21 [ltail = cluster1]; 
}
有向图{
图[label=“问题帧\n映射编辑器\n”,labelloc=t,fontsize=18,component=true];
节点[shape=record,fontsize=10];
边[箭头尾=无,箭头=无,箭头大小=0.8,颜色=ivory4,字体大小=8];
子图“cluster0”{
图[label=“Model Fragment”];
A01[label=“{Domain | class::marking\lisTemplate::boolean default false\lname::name\ltype::Domain type\l}]”;
A02[label=“{Requirement | isTemplate::boolean default false\lname::name\l}]”;
A03[label=“{Requirement Reference\n\| content::name\lis template::boolean default false\ltype::Requirement Reference type\l}”,shape=Mrecord,style=dottered];
A04[label=“{共享现象集\n\|内容::名称\lis模板::布尔默认值false\ltype::现象类型\l}”,shape=Mrecord,style=POINTED];
/*1:1-0:M*/
边[dir=两者,arrowhead=crowodot,arrowtail=无];
A01->A03[样式=虚线];
A01->A04[样式=虚线];
A01->A04[样式=虚线];
A02->A03[样式=虚线];
}
子图“cluster1”{
图形[label=“\>\>\>”,fontsize=24];
B01[label=“{Domain}]”;
B02[label=“{Requirement}]”;
B03[label=“{Requirement\n reference\n}”,shape=Mrecord,style=pointed];
B04[label=“{Shared\nPhenomena\nSet\n}”,shape=Mrecord,style=pointed];
F01[label=“{C0001 | if\[-\>controls-\>descriples.isTemplate\]\l}”;
F02[label=“{C0002 |如果不是\[-\>控制-\>描述.isTemplate\]\l}”;
F03[label=“{C0003 | if\[-\>controls-\>descriples.type=designed\]\l}”;
F04[label=“{C0004 | if\[-\>controls-\>descriptions.type=given\]\l}”;
F05[label=“{C0005 | if\[-\>controls-\>descriptions.type=machine\]\l}”;
F06[label=“{C0006 | if\[-\>controls-\>descriples.marking=biddable\]\l}”;
F07[label=“{C0007 |如果\[-\>控制-\>描述。标记=因果\]\l}”;
F08[label=“{C0008 | if\[-\>controls-\>descriples.marking=lexical\]\l}”;
F09[label=“{C0009 | if\[-\>controls-\>descriptions.marking=null\]\l}”;
F10[label=“{C0010 | if\[-\>controls-\>descriples.isTemplate\]\l}”;
F11[label=“{C0011|if not\[-\>controls-\>descripes.isTemplate\]\l}”;
F12[label=“{C0012 | if\[-\>controls-\>descriples.isTemplate\]\l}”;
F13[label=“{C0013 |如果不是\[-\>控制-\>描述.isTemplate\]\l}”;
F14[label=“{C0014 | if\[-\>controls-\>descriples.type=非约束\]\l}”;
F15[label=“{C0015 | if not\[-\>controls-\>descriptions.type=constraining\]\l}”;
F16[label=“{C0016 | if\[-\>controls-\>descriples.isTemplate\]\l}”;
F17[label=“{C0017 | if not\[-\>controls-\>descripes.isTemplate\]\l}”;
F18[label=“{C0018 | if\[-\>controls-\>descriptions.type=因果\]\l}”;
F19[label=“{C0019 | if\[-\>controls-\>descriples.type=event\]\l}”;
F20[label=“{C0020 | if\[-\>controls-\>descriples.type=symbolic\]\l}”;
边[样式=实体];
B01->F01->F02->F03->F04->F05->F06->F07->F08->F09;
B02->F10->F11;
B03->F12->F13->F14->F15;
B04->F16->F17->F18->F19->F20;
边[style=invi];
B01->B02->B03->B04;
}
子图“cluster2”{
图[label=“\descriptions\l-\>descriptionby.class\l}”];
D04[label=“{Attribute | name::oName\lvalue:=-\>描述了\l-\>由.name\l}”描述的内容;
D05[label=“{Attribute | name::postlabel\lvalue:=\}\”\l}];
D06[label=“{Attribute}name::postlabel\lvalue:=\\\\{\\\\\\\}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\;
D07[label=“{Attribute}name::postlabel\lvalue:=\\\\{\\\\\\}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\;
D08[label=“{Attribute}name::postlabel\lvalue:=\\\\{\\\\\\\}\\\\\\\\\\\\\”\l}”;
D09[label=“{Attribute | name::prelabel\lvalue:=\”\{\\\\l}];
D10[label=“{Attribute | name::prelabel\lvalue:=\”\{\l}];
D11[label=“{Attribute | name::prelabel\lvalue:=\”\{\\\\\\\\\\\\\\\\l}”;
D12[label=“{Attribute | name::oType\lvalue:=-\>描述了\l-\>由.type\l}”描述的内容;
C04[label=“{Holding Box | name:=域模板\lcolor:=slategray\lfillcolor:=white\lfontcolor:=slategray\lfontsize:=9\llabel:=oName\lreadonly:=true\l}”;
D13[label=“{Attribute | name::oName\lvalue:=-\>描述\l-\>由.name\l}”描述];
C05[label=“{Edge | name:=Edge Template\lcolor:=white\llabel=oName\lstyle:=invi\l}”;
D14[label=“{Attribute | name::oName\lvalue:=-\>描述了\l-\>由.contents\l}”描述的内容;
C06[label=“{Node | name:=现象\l}]”;
D15[label=“{Attribute | name::oName\lvalue::-\>描述\l\-\>由.contents\l}描述];
C07[label=“{Edge | name:=Reference\l}]”;
D16[label=“{Attribute | name::oName\lvalue:=-\>描述了\l-\>由.contents\l}”描述的内容;
C08[label=“{Node | name:=需求图标\l}]”;
D17[label=“{Attribute | name::oName\lvalue:=-\>描述了\l-\>由.name\l}描述的内容];
C09[label=“{Edge | name:=共享现象\l}]”;
D18[label=“{Attribute | name::oName\lvalue:=-\>描述了\l-\>由.contents\l}”描述的内容;
D19[label=“{Attribute | name::oType\lvalue:=C\l}]”;
D20[标签=