Search code examples
graphvizdot

dot notation for horizontal flow


I have a graph which is shallow than deep. I wanted it to flow horizontally instead of vertically as is the default.

E.g. instead of

    a 
  /   \
b       c

I want

    b
  /
a
  \
    c

Can we do this in DOT notation?


Solution

  • Yes. At the top of your graph add:

    digraph example {
      rankdir=LR;
      a -> b
      a -> c
    }
    

    This will orient the graph from left to right.

    Before: enter image description here

    After: enter image description here

    References:

    Dot User Guide