
Here's one way to draw the network:
\documentclass[11pt,a4paper,oneside]{book}
\usepackage{tikz}
\begin{document}
\def\ab{.4}
\tikzset{
net node/.style = {circle, minimum width=2*\ab cm, inner sep=0pt, outer sep=0pt, ball color=blue!50!cyan},
net connect/.style = {line width=1pt, draw=blue!50!cyan!25!black},
net thick connect/.style = {net connect, line width=2.5pt},
}
\begin{figure}
\centering
\begin{tikzpicture}
\path [net thick connect]
(0,0) -- (6,0);
\foreach \i/\j in {2/-1,4/-1,1/1,3/1,5/1}
\path [net connect] (\i,0) -- (\i,\j) node [net node] {};
\end{tikzpicture}
\caption{Bus Network Topology}
\end{figure}
\end{document}
Note that it makes no sense to put figure
in a center
environment. Instead, use \centering
within the figure
to centre the diagram. I've set up some styles as that makes it easier to keep things consistent and to change, say, the colour of all nodes if you need to. I've also used a loop to draw the nodes.
There are many ways to do this but this one should be fairly easy to adapt to the other network diagrams, whereas some of the other methods would not generalise as easily, I think.
Note that \a
is an existing command. Use \newcommand
rather than \def
to check for this kind of problem. I've substituted \ab
which is not already taken.
For some of the networks, it may be easier to use polar coordinates to specify the node locations. For example, consider the star which is basically nodes placed on a circle around a hub node:

It would be a pain to calculate the node positions in the system used above, but polar coordinates make the diagram straightforward:
\newcommand*\ab{.4}
\tikzset{
net node/.style = {circle, minimum width=2*\ab cm, inner sep=0pt, outer sep=0pt, ball color=blue!50!cyan},
net root node/.style = {net node, minimum width=3*\ab cm},
net connect/.style = {line width=1pt, draw=blue!50!cyan!25!black},
}
\begin{figure}
\centering
\begin{tikzpicture}
\node (root) [net root node] {};
\foreach \i in {0,...,4}
\path [net connect] (root) -- (-90+\i*72:2) node [net node] {};
\end{tikzpicture}
\caption{Star Network Topology}
\end{figure}
The ring and mesh are very similar:

\begin{figure}
\centering
\begin{tikzpicture}
\foreach \i in {0,...,4}
\path (-90+\i*72:2) node (n\i) [net node] {};
\path [net connect] (n0) -- (n1) -- (n2) -- (n3) -- (n4) -- (n0);
\end{tikzpicture}
\caption{Ring Network Topology}
\end{figure}
\begin{figure}
\centering
\begin{tikzpicture}
\foreach \i in {0,...,4}
\path (-90+\i*72:2) node (n\i) [net node] {};
\foreach \i in {0,...,4}
\foreach \j in {0,...,4}
\path [net connect]
(n\i) -- (n\j);;
\end{tikzpicture}
\caption{Mesh Network Topology}
\end{figure}
For the tree, I would quite unnecessarily use forest
but note that this is entirely egregious! I would do it because it is a tree and forest
is fantastic - not because a diagram this simple needs the power of forest
....

\documentclass[11pt,a4paper,oneside]{book}
\usepackage{tikz,forest}
\begin{document}
\addtocounter{figure}{4}
\newcommand*\ab{.4}
\tikzset{
net node/.style = {circle, minimum width=2*\ab cm, inner sep=0pt, outer sep=0pt, ball color=blue!50!cyan},
net root node/.style = {net node, minimum width=3*\ab cm},
net connect/.style = {line width=1pt, draw=blue!50!cyan!25!black},
}
\begin{figure}
\centering
\begin{forest}
for tree={
edge=net connect,
if level=0{%
net root node,
before typesetting nodes={
repeat=2{
append={[,
net node,
repeat=3{
append={[, net node]},
},
]},
},
},
}{},
}
[]
\end{forest}
\caption{Tree Network Topology}
\end{figure}
\end{document}
What I like about this, of course, is that what actually draws the tree ends up being a single set of square brackets!
The hybrid is more fiddly since there is less of a pattern. I worked from the ring pattern and added the remaining nodes manually, with the help of the calc
library for TikZ.

\usetikzlibrary{calc}
...
\begin{figure}
\centering
\begin{tikzpicture}
\foreach \i in {0,...,4}
\path (-90+\i*72:2) node (n\i) [net node] {};
\path [net connect]
(n0)
edge node [net node, pos=1] {} +(0,-15mm)
edge node [net node, pos=1] {} +(10mm,-15mm)
edge node [net node, pos=1] {} +(-10mm,-15mm)
-- (n1)
edge (n4)
edge (n3)
-- (n2)
-- (n3)
-- (n4)
-- (n0)
($(n2)!1/2!(n3)$) -- +(0,15mm) node [net node] {}
;
\end{tikzpicture}
\caption{Hybrid Network Topology}
\end{figure}
capt-of
so you can have a caption without a float.