graphviz - 如何创建“往返”流程

时间:2013-09-18 16:01:36

标签: graphviz dot

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

  • COM必须是LEFT上的第一个节点。

点代码:

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;

 }

enter image description here

1 个答案:

答案 0 :(得分:3)

如果您只是通过更改线

来反转返回的边的方向(dir=back
NET -> fn2 -> rbd2 -> ddate2 -> fare2 -> COM;

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

你应该得到:

dir back graphviz example