Alex Rivera | Logout

Changing edge direction in dot

Asked 2011-03-24T19:37:43.903
29

I'm trying to draw a pretty simple diagram in dot.

digraph untitled
    {
    rankdir = LR;
    {rank=same; S; A}
    B -> A;
    B -> S;
    A -> A;
    S -> S;
    A -> S ;
    S -> A;
    A -> T;
    S -> T;
}

The results I get is

enter image description here

I really have to change the edge from S -> S, but I would also like to change the orientation of the arrows so they loop from left to right.

Edit
Report

1 Answer

3

I don't know if it is possible to make the arrows loop from left to right. You can exercise a degree of control on the arrows by the use of the dir option eg

S->S[dir=both];

In addition you can influence the layout by changing the length of the link from S to S. You can also control the directions of (non-self referential) arrows by reversing the order the nodes are listed eg:

S->T;
becomes
T->S;

I have found that it nearly always produces better diagrams, the less it is constrained. I would suggest experimenting with removing the rank=same command.

answered 2011-03-24T19:47:25.927

Your Answer