—将节点放置在水平线上

—将节点放置在水平线上

本文介绍了Graphviz —将节点放置在水平线上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下graphviz文件.现在,边缘标签放置在水平线上,但是我希望将节点放置在水平线上.我该如何实现?

I have the following graphviz file. Right now, the edge labels are placed on a horizontal line, but I want the nodes to be placed on a horizontal line instead. How can I achieve this?

 digraph finite_state_machine {
    node [shape = doublecircle]; q_5;
    node [shape = circle];
    q_1 -> q_2 [ label = "." ];
    q_1 -> q_2 [ label = "\epsilon" ];
    q_2 -> q_1 [ label = "\epsilon" ];
    q_2 -> q_3 [ label = "a" ];
    q_3 -> q_4 [ label = "^\wedge a" ];
    q_3 -> q_4 [ label = "\epsilon" ];
    q_4 -> q_3 [ label = "\epsilon" ];
    q_4 -> q_5 [ label = "b" ];
}

这是当前的外观:

推荐答案

您可以使用 rank=same 对所有节点强制使用相同的等级:

You may use rank=same to force the same rank for all nodes:

digraph finite_state_machine {
{
rank=same;
    node [shape = doublecircle]; q_5;
    node [shape = circle];
    q_1 -> q_2 [ label = "." ];
    q_1 -> q_2 [ label = "\epsilon" ];
    q_2 -> q_1 [ label = "\epsilon" ];
    q_2 -> q_3 [ label = "a" ];
    q_3 -> q_4 [ label = "^\wedge a" ];
    q_3 -> q_4 [ label = "\epsilon" ];
    q_4 -> q_3 [ label = "\epsilon" ];
    q_4 -> q_5 [ label = "b" ];
    }
}

这篇关于Graphviz —将节点放置在水平线上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 04:26