# How to make nodes to simple dots instead of being named

I currently have the following code:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=1]
\tikzstyle{every node}=[draw,shape=circle]
\path (0,0) node (p0) {$p_0$}
(-1.5,-1) node (p1) {$p_1$}
(-1.5,-2.5) node (p2) {$p_2$}
(1.5,-2.5) node (p3) {$p_3$}
(1.5,-1) node (p4) {$p_4$}
(0,-3.5) node (p5) { $p_5$};
\draw (p0) -- (p1)
(p0) -- (p1)
(p0) -- (p2)
(p0) -- (p3)
(p0) -- (p4)
(p0) -- (p5)
(p1) -- (p2)
(p1) -- (p3)
(p1) -- (p4)
(p1) -- (p5)
(p2) -- (p3)
(p2) -- (p4)
(p2) -- (p5)
(p3) -- (p4)
(p3) -- (p5)
(p4) -- (p5);
\end{tikzpicture}

\end{document}


but my problem is that this name each node. And i just want a simple dot. How do I do that?

-
Just take out the $p_k$ bits. The names for later referral are in the (pk) bits so are still there. –  Loop Space Apr 24 '12 at 16:32
unbelievable i didnt try that-.- thanks –  Andreas Apr 24 '12 at 16:35

If you remove the $p_1$,...,$p_6$ from your code then you obtain

On another note, have a look at

Is there something like \providetikzstyle similar to \providecommand?

which details that \tikzstyle isn't an ideal command to use. I've used an alternative in my code below.

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[every node/.style={draw,shape=circle,fill=blue}]
\path (0,0) node (p0) {}
(-1.5,-1) node (p1) {}
(-1.5,-2.5) node (p2) {}
(1.5,-2.5) node (p3) {}
(1.5,-1) node (p4) {}
(0,-3.5) node (p5) { };
\draw (p0) -- (p1)
(p0) -- (p1)
(p0) -- (p2)
(p0) -- (p3)
(p0) -- (p4)
(p0) -- (p5)
(p1) -- (p2)
(p1) -- (p3)
(p1) -- (p4)
(p1) -- (p5)
(p2) -- (p3)
(p2) -- (p4)
(p2) -- (p5)
(p3) -- (p4)
(p3) -- (p5)
(p4) -- (p5);
\end{tikzpicture}

\end{document}

-
yea thats it.. can you say anything about changing the node size? –  Andreas Apr 24 '12 at 16:49
@Andreas is that part of your question? :) you can try for example minimum size=2cm –  cmhughes Apr 24 '12 at 16:52
Its a follow up question i guess:) because I think the size of the nodes are to large.. and how would u use that size=2cm ? –  Andreas Apr 24 '12 at 17:00
@Andreas no problem :) try ...,fill=blue,scale=0.5} for example. adjust as necessary –  cmhughes Apr 24 '12 at 17:09
@Andreas: Use minimum size=<length> and inner sep=<length>. Both will make the node bigger than the included content. Then there is always the coordinate node type, i.e. use \coordinate instead of \node or \path .. coordinate ..  instead of \path .. node ... These nodes have zero size, are not displayed at all and can't have any content. –  Martin Scharrer Apr 24 '12 at 17:45

Personally in this case I prefer the syntax coordinate (p) at (x,y) (I know that it's the same things but I don't like {}.

Then the code can be :

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

\begin{tikzpicture}[dot/.style={draw,circle,minimum size=2mm,inner sep=0pt,outer sep=0pt,fill=blue}]
\path \foreach \x/\y [count=\k from 0] in { 0/0,  -1.5/-1, -1.5/-2.5,  1.5/-2.5, 1.5/-1,  0/-3.5}
{coordinate [dot] (p\k) at (\x,\y)};
\draw \foreach \k [count=\j from 1] in {0,...,4}
\foreach \kk  in {\j,...,5}
{(p\k)--(p\kk)};
\end{tikzpicture}

\end{document}


-
Hehe, so I'm not the only one prefering foreach loops ;) –  Tom Bombadil Apr 24 '12 at 18:05
@TomBombadil: \draw \foreach for the win! –  Martin Scharrer Apr 24 '12 at 19:05
+1 I'll vote for this tomorrow (when I have a new batch of votes, I'm all out for today), nice solution :) –  cmhughes Apr 24 '12 at 19:25

You could also reduce your code a lot by using foreach loops. Also it's a good idea to specify parameters via macros, that way you can easily alter the look of your picture. In this example, the node size, node distance and node fillcolor can be changed by just changing the initial commands:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\pgfmathsetmacro{\minsize}{0.2cm}
\pgfmathsetmacro{\nodedist}{3}
\newcommand{\fillcolor}{black}

\begin{tikzpicture}[scale=1]
\tikzstyle{every node}=[draw,shape=circle,minimum size=\minsize,inner sep=0]
\foreach \x in {0,...,5}
\node[fill=\fillcolor] (p\x) at (\x*60:\nodedist) {};
\foreach \x in {0,...,4}
{   \pgfmathtruncatemacro{\startvalue}{\x+1}
\foreach \y in {\startvalue,...,5}
{\draw (p\x) -- (p\y);
}
}
\end{tikzpicture}

\end{document}


-