graphviz - how to create a 'roundtrip' flow

只愿长相守 提交于 2019-12-31 07:07:14

问题


I'm trying to create a 'round trip' graph using the graphviz. Given the result below, my objective is to have the PINK squares between the NET and the COM (note from the picture below that they are pushed to the right after the NET).

  • the COM must be the first node on the LEFT.

the dot code:

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;

 }


回答1:


If you simply reverse the direction of the edges going back (dir=back) by changing the line

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

into

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

you should get:



来源:https://stackoverflow.com/questions/18877045/graphviz-how-to-create-a-roundtrip-flow

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!