2

I drawed a simple path in graph

\begin{center}
\begin{tikzpicture}
\tikzstyle{every node}=[draw,shape=circle]
\draw[xshift=-1cm] (-2,0) node[circle,fill,inner sep=1pt,label=below:$x$](x){};
\draw[xshift=-1cm] (-1,0) node[circle,fill,inner sep=1pt,label=below:$y$](y){};
\draw[xshift=-1cm] (0,0) node[circle,fill,inner sep=1pt,label=below:$z$](z){};
\draw[xshift=-1cm] (1,0) node[circle,fill,inner sep=1pt,label=below:$k$](k){};
\draw (x) -- (k);
\end{tikzpicture}
\end{center}
\end{document}

But I need to draw more 3 vertex on this path (between y and z) enter image description here

I tried the \fill [dot] (x) circle (.3mm); but it doesnot work. Can you help me plz?

  • 2
    Just FYI for the future: the end result of using xshift on everything is that the shift has no effect on the appearance of the graphic. – Paul Gessler Jun 28 '14 at 20:41
5

You could simply use a a dotted line:

\documentclass[tikz]{standalone}

\begin{document}

\begin{tikzpicture}
  \tikzstyle{every node}=[draw,shape=circle]
  \draw[xshift=-1cm] (-2,0) node[circle,fill,inner sep=1pt,label=below:$x$](x){};
  \draw[xshift=-1cm] (-1,0) node[circle,fill,inner sep=1pt,label=below:$y$](y){};
  \draw[xshift=-1cm] ( 0,0) node[circle,fill,inner sep=1pt,label=below:$z$](z){};
  \draw[xshift=-1cm] ( 1,0) node[circle,fill,inner sep=1pt,label=below:$k$](k){};
  \draw (x) -- (y);
  \draw[dotted] (y) -- (z);
  \draw (z) -- (k);
\end{tikzpicture}

\end{document}

enter image description here

To increase the spacing between the dots, add the following to the tikzpicture options:

dotted/.style={dash pattern=on \pgflinewidth off 5pt}

where 5pt ist the new spacing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.