Skip to content

Instantly share code, notes, and snippets.

@basus
Created January 26, 2018 18:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basus/77441dde61f79189303e10d2af5e4e8b to your computer and use it in GitHub Desktop.
Save basus/77441dde61f79189303e10d2af5e4e8b to your computer and use it in GitHub Desktop.
Drawing network topology diagrams with Tikz
\usepackage{tikz}
\usetikzlibrary{arrows.meta,bending,automata,shapes}
\begin{tikzpicture}[,>={Stealth[round]},shorten >=1pt,auto,semithick]
\tikzstyle{host}=[rectangle,draw=black,minimum size=30pt,inner sep=0pt]
\tikzstyle{switch}=[circle,draw=black,minimum size=30pt,inner sep=0pt]
\tikzstyle{middlebox}=[diamond,draw=black,minimum size=30pt,inner sep=0pt]
\node[host] (h1) at (1,0) {\texttt{h1}};
\node[host] (h2) at (5,0) {\texttt{h2}};
\node[switch] (s1) at (3,0) {\texttt{s1}};
\node[middlebox] (l1) at (3,-2) {\texttt{l1}};
\node[middlebox] (l2) at (3,2) {\texttt{l2}};
\path (h1) edge (s1)
(h2) edge (s1)
(l1) edge (s1)
(l2) edge (s1) ;
\end{tikzpicture}
@smolkaj
Copy link

smolkaj commented Jan 26, 2018

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment