# How to make an edges dotted

I have the following, picture and I want to make the edges between 1 and 3 and 1 and dotted. Also if I want to put names on the edges in the pictures how do I do that?

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[transform shape]
\foreach \x in {1,...,4}{%
\pgfmathparse{(\x-1)*360/4}
\node[draw,circle,inner sep=0.15cm] (N-\x) at (\pgfmathresult:1.4cm) {\x};
}
\foreach \x [count=\xi from 1] in {1,...,4}{%
\foreach \y in {\x,...,4}{%
\path (N-\x) edge[ultra thin,-] (N-\y);

}
}
\end{tikzpicture}
\end{document}

• The code fails with a number of errors. Could you please make sure your given code is compilable? – JMP Mar 28 '16 at 6:35
• Thank you so much I was really trying to do it myself and made some failed code, sorry!! – Gidy Mar 28 '16 at 6:49
• Your question is uncomplete. You want to have the edges between 1 and 3, 1 and ??? doted. – JMP Mar 28 '16 at 7:03
• – Jake Mar 28 '16 at 7:06
• Always test the code you post before you post it! (Even if you know it works....) – cfr Mar 28 '16 at 23:56

So here is some code. Sonce you did not mentioned the second node, where the edge starting from 1 should be dotted, I took 4. You basically need to tell tikz in the path options how to draw it. In this case I used [thin, densely dotted]. To place the name nodes you basically have to chose your previously defined node say x and chose the proper anchor, by saying (x.north) (x.west) and so on. Then you just have to properly align your name node with [left] [right] and so on.

\documentclass{article}
\usepackage{tikz}
\usepackage{ifthen}

\begin{document}

\begin{tikzpicture}[transform shape]
\foreach \x / \anchpos / \alignment in {1/east/right,2/north/above,3/west/left,4/south/below}{%
\pgfmathparse{(\x-1)*360/4}
\node[draw,circle,inner sep=0.15cm] (N-\x) at (\pgfmathresult:1.4cm) {\x};
\node at (N-\x.\anchpos) [\alignment] {Name};
}
\foreach \x [count=\xi from 1] in {1,...,4}{%
\foreach \y in {\x,...,4}{%
\ifthenelse{\x=1 \AND $$\y=3 \OR \y=4$$}{
\path (N-\x) edge[thin,-,densely dotted] (N-\y);
}{
\path (N-\x) edge[ultra thin,-] (N-\y);
}
}
}
\end{tikzpicture}

\end{document}