0

我正在尝试使用 graphviz 创建一个“往返”图。鉴于下面的结果,我的目标是在 NET 和 COM 之间有 PINK 方块(请注意下图中它们在 NET 之后被推到右侧)。

  • COM 必须是左边的第一个节点。

点代码:

digraph { 
rankdir = LR;
graph [fontname = "helvetica" ];
node [fontname = "helvetica"];
edge [fontname = "helvetica"];

COM [shape = circle, fillcolor = yellow, style = filled];
NET [shape = circle, fillcolor = yellow, style = filled];

fn1 [shape = BOX, fillcolor = green, style = filled, label = "PORT006"];
clazz1 [shape = BOX, fillcolor = red, style = filled, label = "O"];
ddate1 [shape = BOX, fillcolor = red, style = filled, label = "21-Apr-13"];
status1 [shape = BOX, fillcolor = red, style = filled, label = "OJ3COM6M"];

clazz1exch [shape = BOX, fillcolor = green, style = filled, label = "G"];
ddate1exch [shape = BOX, fillcolor = green, style = filled, label = "13-May-13"];   
status1exch [shape = BOX, fillcolor = green, style = filled, label = "GJ3COM6M"];

fn2 [shape = BOX, fillcolor = pink, style = filled, label = "PORT005"];
rbd2 [shape = BOX, fillcolor = pink, style = filled, label = "O"];
ddate2 [shape = BOX, fillcolor = pink, style = filled, label = "29-Apr-13"];
fare2 [shape = BOX, fillcolor = pink, style = filled, label = "OJ3COM6M"];

{ rank=same; clazz1 -> clazz1exch; }
{ rank= same; ddate1 -> ddate1exch; }
{ rank=same; status1 -> status1exch; }

 COM -> fn1 -> clazz1exch -> ddate1exch -> status1exch -> NET;
 NET -> fn2 -> rbd2 -> ddate2 -> fare2 -> COM;

 }

在此处输入图像描述

4

1 回答 1

3

dir=back如果您只是通过更改线条来反转边缘的方向( )

NET -> fn2 -> rbd2 -> ddate2 -> fare2 -> COM;

进入

edge[dir=back];
COM -> fare2 -> ddate2 -> rbd2 -> fn2 -> NET;

你应该得到:

dir 返回 graphviz 示例

于 2013-09-18T16:58:21.793 回答