Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.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
Graphviz 从超级状态到子状态的点图_Graphviz_Dot - Fatal编程技术网

Graphviz 从超级状态到子状态的点图

Graphviz 从超级状态到子状态的点图,graphviz,dot,Graphviz,Dot,我想生成点代码来绘制所示的等效状态机图。 我将以编程方式创建,我已经完成了状态和超级状态之间的转换。但是我需要一些帮助: 这给了我一个初始转换,但State1应该是集群: digraph { compound=true; node [shape=Mrecord] rankdir="LR" subgraph clusterOpen { label = "State1" State2 } State1 -> State2 [style="so

我想生成点代码来绘制所示的等效状态机图。 我将以编程方式创建,我已经完成了状态和超级状态之间的转换。但是我需要一些帮助:

这给了我一个初始转换,但State1应该是集群:

digraph {
compound=true;
node [shape=Mrecord]
rankdir="LR"

subgraph clusterOpen
        {
        label = "State1"
        State2
}

State1 -> State2 [style="solid"];
 node [shape = point label="" ] i ->State1
} 

通常,Graphviz程序尽量避免将节点放在其他节点的顶部。但是,如果为每个节点显式提供pos属性,则可以将节点放置在任意位置,请参见。 创建输入文件的程序应计算每个节点的pos属性。记住,pos坐标以点为单位,而节点大小以英寸为单位!。您可能可以跳过计算边的样条线,而让Nea来做。 该计划:

digraph {
    graph [bb="0,0,482.8,337"];
    node [label="\N"];
    State1   [height=4.0139,
        label="{State 1|\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}",
        pos="162,144.5",
        shape=Mrecord,
        width=4.5];
    State2   [height=1.3333,
        label="{State 2|\n\n\n\n}",
//      pos="403,144.5",
        pos="220,88",
        shape=Mrecord,
        width=1.6944];
    xp3  [height=0.05,
        label="",
//      pos="429,331",
        pos="0,194",
        shape=point,
//      style=dotted,
        style=invis,
        width=0.05];
    r1   [height=0.16667,
        label="",
//      pos="455,331",
        pos="154,194",
        shape=square,
        width=0.16667];
    xp4  [height=0.05,
        label="",
//      pos="481,331",
        pos="0,88",
        shape=point,
//      style=dotted,
        style=invis,
        width=0.05];
    xp1  [height=0.16,
        label="",
        pos="162,331",
        shape=point,
        width=0.16];
    xp1 -> State1:n  [pos="e,162,288.5 162,325.23 162,319.09 162,308.89 162,298.63",
        style=dashed];
    xp2  [height=0.16,
        label="",
//      pos="403,331",
        pos="220,194",
        shape=point,
        width=0.16];
    xp2 -> State2:n  [pos="e,403,192.5 403,325.19 403,307.39 403,251.8 403,202.57"];

// manually added:
  xp3 -> r1      [label="Trigger 1" dir=none ]    
  xp4 -> State2  [label="Trigger 2"  ]    
}
使用以下命令行运行: neato-n-Tpng stateDiagram.dot>stateDiagram.png

生成此图形:

请说明您目前的情况以及存在的问题。@albert,我已经添加了到目前为止为初始转换所获得的信息。群集的名称是clusterOpen,而不是State1-State1只是标签。你的意思是:State1->State2[style=solid];太美了!当我运行它的时候,框之间是不在一起的???webgraphviz似乎只支持点布局引擎,而不是neato引擎。我尝试了“layout=neato”和其他一些修复程序,结果发现:错误:layout-type:neato无法识别。使用其中一个:点布局未完成-您必须使用本地Graphviz或??