Example: Skype network topology

Published 2011-12-30 | Author: Claudio Fiandrino

Skype uses a decentralized network topology with super nodes and normal clients. This diagram shows the architecture.

Download as: [PDF] [TEX]

Skype network topology

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.

% Skype network topology
% Author Fiandrino Claudio 2011
% http://claudiofiandrino.altervista.org/
\documentclass{article}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{7pt}
\definecolor{lavander}{cmyk}{0,0.48,0,0}
\definecolor{violet}{cmyk}{0.79,0.88,0,0}
\definecolor{burntorange}{cmyk}{0,0.52,1,0}

\def\lav{lavander!90}
\def\oran{orange!30}

\tikzstyle{peers}=[draw,circle,violet,bottom color=\lav,
                  top color= white, text=violet,minimum width=10pt]
\tikzstyle{superpeers}=[draw,circle,burntorange, left color=\oran,
                       text=violet,minimum width=20pt]
\tikzstyle{legendsp}=[rectangle, draw, burntorange, rounded corners,
                     thin,bottom color=\oran, top color=white,
                     text=burntorange, minimum width=2.5cm]
\tikzstyle{legendp}=[rectangle, draw, violet, rounded corners, thin,
                     bottom color=\lav, top color= white,
                     text= violet, minimum width= 2.5cm]
\tikzstyle{legend_general}=[rectangle, rounded corners, thin,
                           burntorange, fill= white, draw, text=violet,
                           minimum width=2.5cm, minimum height=0.8cm]
\begin{document}
\begin{tikzpicture}[auto, thick]
  % Place super peers and connect them
  \foreach \place/\name in {{(0,-1)/a}, {(2,0)/b}, {(2,2)/c}, {(0,2)/d},
           {(-2,0)/e}}
    \node[superpeers] (\name) at \place {};
  \foreach \source/\dest in {a/b, a/c, a/d, b/c, c/d,a/e,d/e}
    \path (\source) edge (\dest);
   %
   % Place normal peers
  \foreach \pos/\i in {above left of/1, left of/2, below left of/3}
    \node[peers, \pos = e] (e\i) {};
   \foreach \speer/\peer in {e/e1,e/e2,e/e3}
    \path (\speer) edge (\peer);
   %
   \foreach \pos/\i in {above right of/1, right of/2, below right of/3}
    \node[peers, \pos =b ] (b\i) {};
   \foreach \speer/\peer in {b/b1,b/b2,b/b3}
   \path (\speer) edge (\peer);
   %
   \node[peers, above of=d] (d1){};
   \path (d) edge (d1);
   %
   \foreach \pos/\i in {below left of/1, below of/2}
   \node[peers, \pos =a ] (a\i) {};
   \foreach \speer/\peer in {a/a1,a/a2}
   \path (\speer) edge (\peer);
   %%%%%%%%
   % Legends
   \node[legendsp] at (5,0) {\small{Super-peers}};
   \node[legendp] at (5,2) {\small{Normal peers}};
   \node[legend_general] at (0,4) {\small{\textsc{Skype-topology}}};
\end{tikzpicture}
\end{document}

Comments

  • #1 kartik, September 28, 2012 at 8:16 p.m.

    I m getting an error stating: preview.sty file not found.how can i rectify the error

  • #2 Jimi Oke, November 9, 2012 at 5:09 p.m.

    @kartik: This likely means you don't have the Preview package installed (or latex cannot locate it for some reason). Check your distribution and install it or go to ctan.org to download the package.

    In any event, I doubt the package is required to run this example. Try commenting out the line "\usepackage[active,tightpage]{preview}" and see if it compiles.

  • #3 Jimi Oke, November 9, 2012 at 5:10 p.m.

    You would also have to remove "\PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{7pt}"

Adding comments is currently not enabled.