How can I find out in gvpr whether rankdir is LR or TB?

The topic title says it all:

How can I find out in a gvpr script whether the current graph ($G) has a rankdir of LR or TB?

Many thanks for any pointers!

BEG_G{
  string RD;
  RD="TB";  // default
  if (hasAttr($G, "rankdir") && $G.rankdir!="")
    RD=$G.rankdir;
  print($F,"  ",RD,"  >",$G.rankdir,"<");
}

command line to test: gvpr -qf rankdir.gvpr *.gv

1 Like