# Draw ellipsis (three dots) between nodes in tikz

I am beginning to learn tikz to draw a simple graph. I would like to represent the idea that there are N nodes by drawing something like this:

How can I draw an ellipsis: ... between the two nodes?

Here is the code I used for the above:

\documentclass[12pt,a4paper]{report}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.5cm,
main node/.style={thick,circle,draw,font=\sffamily\Large}]

\node[main node] (1) {$X_1$};
\node[main node] (2) [right of=1]{$X_N$};
\node[main node] (5) [below of=1]{C};

\path[every node/.style={font=\sffamily\small}]
(1) edge (5);
\end{tikzpicture}
\end{document}


(Other comments on how to improve my tikz code are welcome.)

Another way would be to say \path (1) -- node[auto=false]{\ldots} (2);. You've turned on the auto setting in the tikzpicture options, auto=false turns it off.

Also, it is recommended to load the positioning library and use right=of instead of saying just right of=. See Difference between "right of=" and "right=of" in PGF/TikZ.

Finally, I don't really think the [every node... option to your last path does anything.

\documentclass[12pt,border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}

\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=1.5cm,
main node/.style={thick,circle,draw,font=\sffamily\Large}]

\node[main node] (1) {$X_1$};
\node[main node] (2) [right=of 1]{$X_N$};
\node[main node] (5) [below=of 1]{C};

\path (1) edge (5);

\path (1) -- node[auto=false]{\ldots} (2);
\end{tikzpicture}
\end{document}

• Interesting about the positioning! +1 :D Jun 1 '15 at 11:01

You can add a node, without any border, and use \ldots.

The syntax at ($(1)!.5!(2)$) means "place it at half distance between 1 and 2". This requires the calc library.

One more thing: I switched from arrows to arrows.meta because the former is deprecated. See the Tikz manual (16.5 Reference: Arrow Tips, page 203) for more details on how to define the arrow tips. Alas, the tips are a bit different, if you want it round add >={Stealth[round]}.

Edit: Apart from the fixed positioning, I placed your node options in a \tikzset, see the new code, and used \draw () -- (); instead.

## Code

\documentclass[12pt,a4paper]{report}
\usepackage{tikz}
\usetikzlibrary{calc,arrows.meta,positioning}

\tikzset{
every node/.style={font=\sffamily\small},
main node/.style={thick,circle,draw,font=\sffamily\Large}
}

\begin{document}
\begin{tikzpicture}[->,>={Stealth[round,sep]},shorten >=1pt,auto,node distance=2.5cm]

\node[main node] (1) {$X_1$};
\node[main node] (2) [right =of 1]{$X_N$};
\node[main node] (5) [below =of 1]{C};

\node at ($(1)!.5!(2)$) {\ldots};

\draw (1) -- (5);
\end{tikzpicture}
\end{document}