# individual path distance between nodes

I have been using the Tikz package to draw NFA's and DFA's, and it's a good package to do so with, but sometimes I have to be extra creative in my setup of it. It would be much easier if there was a possibility to make change one distance between two nodes. Does anybody know if such a possibility exists with the Tikz package?

\documentclass[a4paper,12pt]{article}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}

\begin{document}

\begin{figure}
\begin{tikzpicture}[node distance = 2cm]

\node[initial,state]        (1)                     {$1$};
\node[state]                (2) [right of=1]        {$2$};
\node[accepting,state]      (3) [right of=2]        {$3$};

\path (1) edge    node  {}  (2)
(2) edge    node  {}  (3);
%ex make the distance between node 2 and 3 more than 2 cm

\end{tikzpicture}
\end{figure}

\end{document}

-

You can also use positioning library:

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,positioning}

\begin{document}

\begin{figure}
\begin{tikzpicture}[node distance = 2cm]

\node[initial,state]        (1)                     {$1$};
\node[state]                (2) [right of=1]        {$2$};
\node[accepting,state]      (3) [right =4cm of 2,blue,ultra thick]        {$3$};

\path (1) edge    node  {}  (2)
(2) edge    node  {}  (3);
%ex make the distance between node 2 and 3 more than 2 cm

\end{tikzpicture}
\end{figure}

\end{document}

-
Not sure why I keep forgetting about that. Nice choice of coloring though. :-) –  Peter Grill Dec 6 '12 at 1:38

You can move a node by adding xshift=<length>:

Using node distance=4cm also seems to work.

## Code:

\documentclass[a4paper,12pt]{article}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}

\begin{document}

\begin{figure}
\begin{tikzpicture}[node distance = 2cm]

\node[initial,state]        (1)                     {$1$};
\node[state]                (2) [right of=1]        {$2$};
\node[accepting,state]      (3) [right of=2,xshift=2cm,blue,ultra thick]        {$3$};

\path (1) edge    node  {}  (2)
(2) edge    node  {}  (3);
%ex make the distance between node 2 and 3 more than 2 cm

\end{tikzpicture}
\end{figure}

\end{document}

-