# How to draw double circle node in tikz?

Consider the following code:

\begin{document}

\begin{figure}
\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=5 cm, scale = 1, transform shape]

\node[initial,state] (A)                                    {$s_0$};
\node[state]         (B) [right of=A]                       {$s_2$};
\node[state]         (C) [above of=B]                       {$s_1$};
\node[state]         (D) [below of=B]                       {$s_3$};

\path[->] (A) edge [left]       node [align=center]  {$c = c + 1$} (C)
(A) edge [above]      node [align=center]  {$c = c + 5$} (B)
(A) edge [left]       node [align=center]  {$c = c - 1$} (D)
(B) edge [right]      node [align=center]  {$c = c - 1$} (D)
(C) edge [loop above] node [align=center]  {$c = c + 1$} (C)
(D) edge [loop below] node [align=center]  {$c = c - 2$} (D);

\end{tikzpicture}
\caption{An example of SST}
\end{figure}

\end{document}


I get the following automaton :

How can I draw S2 and S4 as final states (double circle)?

-
You should also add a preamble to your examples. It is annoying to have to add them manually for test. Beside this, did you try to add the option double to your node? – Ulrike Fischer Jul 18 '12 at 9:14

That could be done by means of the option accepting (see as reference 25 Automata Drawing Library in the pgfmanual version April 25, 2012).

Code (I assumed s_1 and s_3 as final states):

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{automata,arrows}

\begin{document}
\begin{figure}
\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=5 cm, scale = 1, transform shape]

\node[initial,state] (A)                                    {$s_0$};
\node[state]         (B) [right of=A]                       {$s_2$};
\node[state,accepting]         (C) [above of=B]                       {$s_1$};
\node[state,accepting]         (D) [below of=B]                       {$s_3$};

\path[->] (A) edge [left]       node [align=center]  {$c = c + 1$} (C)
(A) edge [above]      node [align=center]  {$c = c + 5$} (B)
(A) edge [left]       node [align=center]  {$c = c - 1$} (D)
(B) edge [right]      node [align=center]  {$c = c - 1$} (D)
(C) edge [loop above] node [align=center]  {$c = c + 1$} (C)
(D) edge [loop below] node [align=center]  {$c = c - 2$} (D);

\end{tikzpicture}
\caption{An example of SST}
\end{figure}

\end{document}


-
Also, putting option double at those nodes. – JLDiaz Jul 18 '12 at 9:15
Yes, it works too, but I preferred to use accepting since the OP works with the automata library. – Claudio Fiandrino Jul 18 '12 at 9:16