如何在(简单)有向图中强制使用直边?

时间:2018-06-18 10:10:57

标签: graphviz

我有以下简单的有向图:

digraph clientproxyserver {
  "Client" -> "Proxy" [ label="Request from Client" ];
  "Proxy" -> "Server" [ label="Forwarded Request" ];
  "Server" -> "Proxy" [ label="Response from Server" ];
  "Proxy" -> "Client" [ label="Forwarded Response" ];
}

运行此低谷dot

dot -Grankdir=LR -Nshape=box -Nheight=1 -Tpng -ocps.png cps.gv

我得到以下结果:

Resulting graph

如何使两条底边成直线?

1 个答案:

答案 0 :(得分:1)

通常,选项splines=ortho用于以下目的:

myEditor.getData();

不幸的是,边缘/标签的位置非常混乱:

otho layout

根据我的经验,digraph clientproxyserver { rankdir=LR; node[shape=box, height=1]; splines=ortho "Client" -> "Proxy" [ label="Request from Client" ]; "Proxy" -> "Server" [ label="Forwarded Request" ]; "Server" -> "Proxy" [ label="Response from Server" ]; "Proxy" -> "Client" [ label="Forwarded Response" ]; } 样条曲线很少会产生令人满意的结果。

另一种选择是使用ortho

polyline layout