Graphviz---如何使边不交叉;选择自环边的位置

10
我有以下的点文件:
digraph finite_state_machine {                                                                                                                                                                                  
    pad=0.2;
    {
        rank=same;
        node [shape = doublecircle]; q_3;
        node [shape = circle];
        q_1 [ label = <<b><i>q<sub>1</sub></i></b>> ];
        q_2 [ label = <<b><i>q<sub>2</sub></i></b>> ];
        q_3 [ label = <<b><i>q<sub>3</sub></i></b>> ];
        q_1 -> q_1 [ label = <<b><i>^a</i></b>> ];
        q_1 -> q_2 [ label = <<b><i>a</i></b>> ];
        q_2 -> q_2 [ label = <<b><i>^b</i></b>> ];
        q_2 -> q_3 [ label = <<b><i>b</i></b>> ];
    }
}

我得到了以下输出:output image

我想让自环在节点的顶部,而不是跨越其他边。如果可能的话,希望有更多的环。我该如何实现?

我希望它看起来像这样:

1个回答

17
你可以使用端口/罗盘点: ports/compass points
q_1:e -> q_1:w [ label = <<b><i>^a</i></b>> ];
q_2:e -> q_2:w [ label = <<b><i>^b</i></b>> ];

graphviz with loopy loops

或者使用nw/ne作为指南针点:

Event loopier loops


谢谢你的努力,但我不喜欢结果。我编辑了我的帖子并加入了一张我想要的图片。或者也许我可以使用ne和nw作为方向/点。我明天再试试。 - oskarkv
1
当然,你可以使用nw / ne作为罗盘点,我添加了一个修改后的示例。 - marapet

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接