# Tikz - cannot figure out why my lines won't connect

I cannot figure out why my code doesn't compile into the attached image, not sure if I am missing something in how Tikz works or there's another issue:

Code

\begin{tikzpicture}
\node[shape=circle,draw=black] (1) {$1$};
\node[shape=circle,draw=black] (2) [right of=1] {$2$};
\node[shape=circle,draw=black] (3) [below of=1] {$3$};
\node[shape=circle,draw=black] (4) [right of=3] {$4$};
\path[]
(4) edge [loop below] node (4)
(1) [-] edge node[right] (2)
(1) [-] edge node[below] (3)
(2) [-] edge node[above] (3);
\end{tikzpicture}


What it should look like

What it does look like

• Hi, welcome. The first thing to note is perhaps that your code throws an error, so you cannot really expect the output to be correct. – Torbjørn T. Feb 12 '19 at 21:25
• It didn't throw an error in my editor but I tossed it in a linter and sure enough, I need labels for lines even if they are empty. This solves it! Thanks. – deversEatsALot Feb 12 '19 at 21:31

You had unnecessary nodes in the path. (celi solved the problem in their answer by adding {}, which makes the code compile but adds nodes that seem not to be used.)

\documentclass[border=3.14mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\node[shape=circle,draw=black] (1) {$1$};
\node[shape=circle,draw=black] (2) [right of=1] {$2$};
\node[shape=circle,draw=black] (3) [below of=1] {$3$};
\node[shape=circle,draw=black] (4) [right of=3] {$4$};
\path[]
(4) edge [loop below] (4)
(1) [-] edge  (2)
(1) [-] edge  (3)
(2) [-] edge  (3);
\end{tikzpicture}
\end{document}


• @deversEatsALot used nodes with placement, so i figured he wanted a label there eventually, but you are right, your solution is a lot cleaner. – celi Feb 12 '19 at 22:39

This works for me:

\begin{tikzpicture}
\node[shape=circle,draw=black] (1) {$1$};
\node[shape=circle,draw=black] (2) [right of=1] {$2$};
\node[shape=circle,draw=black] (3) [below of=1] {$3$};
\node[shape=circle,draw=black] (4) [right of=3] {$4$};
\path (1) edge [] node [left] {} (2)
(1) edge [] node [below] {} (3)
(2) edge [] node [above] {} (3)
(4) edge [loop above] node[] {} (4);
\end{tikzpicture}