5

When there are two nodes pointing to the same node, the picture looks odd because they point to the same location. How can I change the location of pointing?

For instance,

\documentclass[10pt,letterpaper]{article}
\usepackage[latin1]{inputenc}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry} 
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\def\xcolorversion{2.00}
\def\xkeyvalversion{1.8}

\usepackage[version=0.96]{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,snakes,automata,backgrounds,petri,positioning}

\begin{document}    
    \textbf{DFA}\\
    \begin{tikzpicture}[shorten >=1pt,node distance=3cm,on grid,auto] 
        \node[state,initial,accepting]      (q_0)                           {$q_0$};
        \node[state,accepting]              (q_1)   [right=of q_0]          {$q_1$};
        \node[state]                        (q_2)   [right=of q_1]          {$q_2$};    
        \node[state,accepting]              (q_3)   [right=of q_2]          {$q_3$}; 
        \node[state]                        (q_4)   [above right=of q_3]    {$q_4$};    
        \node[state,accepting]              (q_5)   [below right=of q_3]    {$q_5$};        

        \path[->]
        (q_0)   edge    [bend right]        node {0}            (q_1)
        (q_0)   edge    [bend right]        node {1}            (q_3)

        (q_1)   edge    [above,bend right]  node {0}            (q_0)
        (q_1)   edge    [above,bend right]  node {0}            (q_3)

        (q_2)   edge                        node {0}            (q_1)
        (q_2)   edge    [above,bend left]   node {0}            (q_4)

        (q_3)   edge                        node {0,1}          (q_5)

        (q_4)   edge                        node {0,1}          (q_3)
        (q_5)   edge    [loop below]        node {0,1}          (q_1)

        ; %end path 
    \end{tikzpicture}
\end{document}  

Output of code

What I want to achieve is one arrow to point to below the circle and the other point to somewhere else.

David Carlisle
  • 757,742
roxrook
  • 9,907

1 Answers1

6

You can fix output and input angle with in and out options

(q_0) edge [bend right, out=-60, in=240] node {1} (q_3)
Ignasi
  • 136,588