# Why is the root node not centered?

I'm trying to code a star graph, using the tikz graphs library. This is what I have so far:

\documentclass[border=10pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{graphs}

\begin{document}
\pagestyle{empty}

\begin{tikzpicture}

hidden -> \foreach \i in {1,...,10} {p\i/$P_{\i}$}};

\end{tikzpicture}
\end{document}


The result is this:

Why is the root node not centered? Shouldn't everything be nicely disposed around (0, 0)?

• @Zarko, I am not a native speaker, but I am not sure your edit is correct. Apologies if you are a native speaker and I'm talking nonsense :) Jul 28, 2021 at 15:07
• Actually, your first title was syntaxically correct ;) Jul 28, 2021 at 15:46
• @SebGlav: ‘syntactically’. Jul 28, 2021 at 16:04
• Aha, of course ^^ Those mismatches between French and English. That was exactly the place to make this mistake. Thanks, Bernard. Jul 28, 2021 at 16:07
• You still can revert my correction of title. Jul 28, 2021 at 16:57

If your plan is just to draw this particular circular graph, I would not use the graphs library but do the following:

\documentclass[border=3.14mm,tikz]{standalone}
\usetikzlibrary{shapes}

\begin{document}
\begin{tikzpicture}
\node[ellipse,inner sep=1pt] (h) {hidden};
\foreach \i in {1,...,10}
\draw [->] (h) -- (126-36*\i:2) node[shift=(123-36*\i:8pt)] (p\i){$P_{\i}$};
\end{tikzpicture}
\end{document}


Note that I used a radius of 2cm, because with only 1 cm, all nodes were too close from the centre, for my taste.

• Thanks, this is helpful! I do want to use graphs, as I plan to complicate the graph a bit from this MWE. Jul 28, 2021 at 15:59
• So the way you're doing it is wrong. See this, for example. Jul 28, 2021 at 16:00