TikZ Library to draw Switching architectures

View project onGitHub


Welcome! This is the homepage of Sa-TikZ, a TikZ library to draw Switching architectures.

The version v0.6 provides a way to draw Clos Networks Strictly-non-Blocking (snb) and Rearrangeable (rear), Benes Networks and Banyan Networks (in particular Omega and Flip Networks); moreover, the package provides the possibility to fully customize the aspect of the drawn network: the dimensions of module, their distance and the font used are few examples. Finally, Sa-TikZ let the user to draw connections among the stages by accessing the single ports of the modules.

Sa-TikZ is distributed under TeXLive and MiKTeX and it is part of the Comprehensive TeX Archive Network - CTAN. The official CTAN page is it provides a link to download the documentation, also accessible typing in a terminal texdoc sa-tikz.

How to contact the author

To contact me for feature requests or problems you can send me an e-mail.

Please, if you have problems try to produce a minimal working example (MWE): this helps in understanding more quickly the issue and to give you a faster answer.


Simple examples of Clos Networks

Clos Networks could be Strictly Non Blocking or Rearrangeable. Sa-TikZ allows to draw them in both modes by computing automatically the constraints that define a Clos Network to belong to a given type.

In the first example it is shown a Clos Network Strictly Non Blocking 8x10 with modules 2x2 for the first and the last stage.


The code:


 \node[N=8, r1=4, M=10, clos snb] {};

The same Clos Network 8x10 with modules 2x2 for the first and the last stage is now drawn in order to be Rearrangeable.


The code:


 \node[N=8, r1=4, M=10, clos rear] {};

A simple example of Benes Networks

This example represents a Benes Network 32x32 drawn in its whole completexity.


The code:


 module size=0.6cm,
 pin length factor=0.5,
 module ysep=1]
 \node[P=32,benes complete] {};

An advanced example

This advanced example shows a possible configuration of a Benes Network step by step in a presentation. Notice how in the left column it is shown the next built path before it is drawn in the network: this could be done using in the proper way the instruments provided by Beamer.


The code:

\usetikzlibrary{switching-architectures} %


% legend image
  \tikz[baseline=-0.5ex]\draw[#1,ultra thick](0,0)--(1.5em,0);

% arrow

% connection description
  \item<+->[\leg{#1}] in #2 \tikzarrow\ out #3

\begin{frame}{A Benes Network: a possible configuration}
% The network
% Style to customize the module's aspect 
\tikzset{module size definition/.style={
  module size=0.75cm,
  pin length factor=0.75,
  module xsep=2.25,
  module ysep=1.25,
\begin{tikzpicture}[scale=0.9,transform shape]
\node[module size definition,benes complete={module label opacity=0}] {};
% Labels
% * * * 
% input
\foreach \startmodule in {1,...,4}{
  \foreach \port in {1,...,2}{
    \node[left,font=\tiny] at (r1-\startmodule-front input-\port)
% * * * 
% output
\foreach \startmodule in {1,...,4}{
  \foreach \port in {1,...,2}{
    \node[right,font=\tiny] at (r5-\startmodule-front output-\port)
% * * * 
% Connections
% overlay starts with 2 such that the newtork is empty at the beginning
\draw<2->[red,ultra thick](r1-2-input-1)--(r1-2-output-2)--
\draw<3->[blue,ultra thick](r1-4-input-1)--(r1-4-output-1)--
\draw<4->[orange,ultra thick](r1-4-input-2)--(r1-4-output-2)--
\draw<5->[green!50!black,ultra thick](r1-3-input-2)--(r1-3-output-2)--
\draw<6->[violet!70,ultra thick](r1-1-input-2)--(r1-1-output-2)--
\draw<7->[blue!50!cyan,ultra thick](r1-3-input-1)--(r1-3-output-1)--
\draw<8->[brown,ultra thick](r1-2-input-2)--(r1-2-output-1)--
\draw<9->[gray,ultra thick](r1-1-input-1)--(r1-1-output-1)--
% avoids to much space between columns
% Column with connections: they are displayed one frame
% before being drawn