문제

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;

 }

enter image description here

도움이 되었습니까?

해결책

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:

dir back graphviz example

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top