Edge Placement

I am trying to have control over edge placement. In the following code, there is a self-loop on node q2 (see commented line): digraph bypass { edge [fontname = "courier"]; rankdir = LR; node [shape = point, color = white ]; q node [shape = "circle", color = "black"]; q0, q1, q2, q3; q4 [shape = "doublecircle"]; {rank = same q2 q3} q -> q0; q0 -> q1 [label = "λ"]; q1 -> q2 [label = "a"]; q2 -> q3 [label = "a"]; q1 -> q3 [label = "b"]; q3 -> q2 [label = "b"]; q2 -> q2 [label = "b"]; /* How to fix? */ q3 -> q3 [label = "a"]; q2 -> q4 [label = "a"]; q3 -> q4 [label = "λ"]; } This places all loops at the top of nodes where they occur. I tried using compass points, but this only made things worse. Is there a way to tell Graphviz to move the loop to the bottom? Or any other location? Thanks.

Formatting

Here is the code more readable:

digraph bypass {
    edge [fontname = "courier"];
    rankdir = LR;
    node [shape = point, color = white ]; q
    node [shape = "circle", color = "black"]; q0, q1, q2, q3;
    q4 [shape = "doublecircle"];
    {rank = same q2 q3}
    q -> q0;
    q0 -> q1 [label = "λ"];
    q1 -> q2 [label = "a"];
    q2 -> q3 [label = "a"];
    q1 -> q3 [label = "b"];
    q3 -> q2 [label = "b"];
    q2 -> q2 [label = "b"]; /* How to fix? */
    q3 -> q3 [label = "a"];
    q2 -> q4 [label = "a"];
    q3 -> q4 [label = "λ"];
}

What is wrong with using q2

What is wrong with using

q2 -> q2 [label = "b" tailport=s headport=s];

?

Recent comments