# Separating edges starting from same node

I have following code -

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,calc,shapes, positioning}

\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,node distance=3.0cm,thick]
\tikzstyle{every state}=[fill=white,draw=black,text=black,minimum size=45pt]

\node[state]         (A) {$A$};
\node[state]         (B) [right of=A] {$B$};
\node[state]         (C) [right of=B] {$C$};

\path (A) [loop above] edge (A);
\path (A) edge (B)
(B)  edge  (C)
(A) edge [bend left=45] node [above, xshift=-2mm,yshift=-3.5mm,very near start] {$1$} (B)
(A) edge [bend left=45] (C);

% Hard-coded the token location since i don't know about it.
\fill[black] (0.00,1.75) circle  (2pt);
\end{tikzpicture}

\end{document}


This generates an image like this -

However, I would like to add some text to the edges. Thus I want to have my output something like this -

How can I achieve this in the Tikz?

Thanks ! Raj

-
Does setting bend left=25 for the edge from A to B achieve what you're trying to do? – Jake Dec 11 '12 at 15:26
oh yes ! I tried and it worked ! :) Thanks a lot ! – knowledge_seeker Dec 11 '12 at 15:28

Every tikz node has 360 anchor points using the notation nodename.angle, being angle an integer between 0 and 360. Those anchors are placed at the intersection between the node shape and a radius with the given angle. You can use those anchors to set the starting point of the arcs, and also for the labels with $1$.

UPDATE: Also, a small improvement about the dot you place "manually". It is more convenient giving the coordinates of that point in polar coordinates with respect node A. The point is located at 9mm at north of A.north, so you can specify its coordinates as (A.north) +(90:9.1mm). The 9.1mm part is still manually estimated, but making the coordinates relative saves you from recalculate them if you move the A node.

Quoting only the relevant part:

  \path (A) [loop above] edge (A);
\path (A) edge (B)
(B) edge  (C)
(A.20) edge [bend left=30]  (B)
(A.22) node[above] {$1$}
(A.50) edge [bend left=45] (C)
(A.52) node[above] {$1$};

\fill[black] (A.north) +(90:9.1mm) circle  (2pt);


Produces:

# Second update

The proper way of adding the token in the edge is to use a markings decoration. The syntax is a bit utgly because the decoration has to be added in a postaction, but using the example provided below you can easily add tokens to any edge in your graph.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{arrows,automata,decorations.markings}
\tikzset{ % Use this style and postaction={decorate} to put a token in an edge
put token/.style={
decoration={markings, mark=at position 0.5 with {\fill[red] circle(2pt); }},
},
}

\begin{tikzpicture}[node distance=3.0cm,thick]
\tikzset{
every state/.append style={fill=white,draw=black,text=black,minimum size=45pt},
every edge/.append style={->,>=stealth',shorten >=1pt}
}

\node[state]   (A) {$A$};
\node[state]   (B) [right of=A] {$B$};
\node[state]   (C) [right of=B] {$C$};

\path (A) edge[loop above, put token, postaction={decorate}] (A);
\path (A) edge (B)
(B) edge  (C)
(A.20) edge [bend left=30]  (B)
(A.22) node[above] {$1$}
(A.50) edge [bend left=45] (C)
(A.52) node[above] {$1$};
\end{tikzpicture}
\end{document}


-
ah this is great ! :) – knowledge_seeker Dec 11 '12 at 15:42
even the dot improvement looks good... I was going to put something like this - node[midway,above=-7pt] {\tikz\fill circle (3pt);} but somehow it didn't work. – knowledge_seeker Dec 11 '12 at 15:51
@RajTendulkar I added an example of using decorations.markings to put the token at the correct place in a general way. It looks the right thing to do. – JLDiaz Dec 11 '12 at 17:37
I think its even more clean. :) Thanks ! – knowledge_seeker Dec 11 '12 at 17:40

This is the final code -

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,calc,shapes, positioning}

\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,node distance=3.0cm,thick]
\tikzstyle{every state}=[fill=white,draw=black,text=black,minimum size=45pt]

\node[state]         (A) {$A$};
\node[state]         (B) [right of=A] {$B$};
\node[state]         (C) [right of=B] {$C$};

\path (A) [loop above] edge (A);
\path (A) edge (B)
(B)  edge  (C)
(A) edge [bend left=30] node [above, xshift=-1mm,yshift=-0.85mm,very near start] {$1$} (B)
(A) edge [bend left=50] node [above, xshift=-5mm,yshift=-3.5mm,very near start] {$1$} (C);

% Hard-coded the token location since i don't know about it.
\fill[black] (0.00,1.75) circle  (2pt);
\end{tikzpicture}

\end{document}

-