I'm trying to create a star graph in Latex. My graph may have an arbitrary large number of vertices, so I'm trying to incorporate this fact in the drawing.
This is what I have done so far:
%My Macros:
\usepackage{amsmath,amsthm,amssymb,bbm,mathtools}
\usepackage{xcolor}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{blkarray} %for stating column index
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\caption{Star Graph}
\begin{tikzpicture}
\label{star_poa}
\def \n {20}
\def \N {8}
\def \radius {3cm}
\def \rd {1mm}
\def \rer {4mm}
\def \margin {8} % margin in angles, depends on the radius
\node[draw, circle] at (360:0mm) {$u_*$};
\node[draw, circle] at ({360/\n *\n / 4}:\radius) {$u_{1}$};
\node[draw, circle] at ({360/4 - 360/\n * (2 - 1)}:\radius) {$u_2$};
\node[draw, circle] at ({360/4 - 360/\n * (3 - 1)}:\radius) {$u_3$};
\node[draw, circle] at ({360/4 - 360/\n * (4 - 1)}:\radius) {$u_4$};
\node[draw, circle] at ({360/4 + 360/\n * (2 - 1)}:\radius) {$u_t$};
\path
({360/4 - 360/\n * (1 - 1)}:{\rer}) edge node [left] {a} ({360/4 - 360/\n * (1 - 1)}:\radius-\margin-\rd);
\path
({360/4 - 360/\n * (2 - 1)}:{\rer}) edge node [left] {a} ({360/4 - 360/\n * (2 - 1)}:\radius-\margin-\rd);
\path
({360/4 - 360/\n * (3 - 1)}:{\rer}) edge node [left] {a} ({360/4 - 360/\n * (3 - 1)}:\radius-\margin-\rd);
\path
({360/4 - 360/\n * (4 - 1)}:{\rer}) edge node [left] {a} ({360/4 - 360/\n * (4 - 1)}:\radius-\margin-\rd);
\path
({360/4 + 360/\n * (2 - 1)}:{\rer}) edge node [left] {a} ({360/4 + 360/\n * (2 - 1)}:\radius-\margin-\rd);
\def \alph {360/4 - 360/\n * (5 - 1)}
\foreach \s in {1,...,\N}
{
\path
({\alph -(360-\alph)/\N *\s}:{\rer}) edge [white,text=black,anchor=south,sloped] node [] {\dots\dots} ({\alph -(360-\alph)/\N *\s}:\radius-\margin-\rd);
}
\path
({360/4 + 360/\n * (4 - 1)}:{\rer}) edge [white,text=black,anchor=south,sloped] node [] {\dots \dots} ({360/4 + 360/\n * (4 - 1)}:\radius-\margin-\rd);
\end{tikzpicture}
\end{figure}
\end{document}
But it turns out pretty bad – the dots aren't symmetric, and their angle seems to be out of place. Any idea on how I can prettify it?
Thanks!
Best Answer
Following you'll find two options, the first is based in
Matsmath
suggestion, the second in red is mine. You can choose.