# How can I draw a compute node?

I want to draw following figure, reference SLURM page-6.

I was not able to find any example for computer science figures like this one. I was wondering is there any pre-defined shape for this in the shapes library or anything similiar to look like a desktop computer?

• There isn't one. Do you need to connect lines directly to the border or do you only need to place these nodes in your diagram? Aug 1 at 9:42
• If I understand your question correctly,I want to place this node in my diagram where there could be multiple nodes connect via arrows. Aug 1 at 9:52
• Yes, you did. Only a proper shape can do this correctly automatically. Which raises the question on how the border of the shape is defined and how one can calculate it. (The math isn't very complex, you just need to write it down in a PGF-way.) Is it just another slim rectangle attached to the bottom of another rectangle? Aug 1 at 10:04
• Ah I got your point :) The behind rectangle border could be bolder probably double thickness Aug 1 at 10:22

As already mentioned in the comments, there is probably no predefined node of this kind. Yet it is easy to create something that looks like the screen shot.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[compute/.style={draw,thick,font=\sffamily,
append after command={
(\tikzlastnode.south west) edge[double=gray!50,double distance=3pt,
line cap=rect,
shorten >=-2pt,shorten <=-2pt]
(\tikzlastnode.south east)}}]
\node[compute] (n1) {Node};
\node[compute,right=2cm of n1] (n2) {More text};
\draw[thick,-stealth] (n1) -- (n2);
\end{tikzpicture}
\end{document}


• Why do we use \tikzlastnode.south west ? Aug 1 at 10:14
• \tikzlastnode is the last node, i.e. the node that gets created, and south west is its lower left corner (as long as the node does not get rotated).
– user277428
Aug 1 at 10:27
• If there is not text inside the rectangle can we also align it width? Aug 1 at 12:29
• You can use something like \node[compute,minimum width=2cm,minimum height=1em] (n1) {};, or \node[compute] (n1) {\phantom{Node}};.
– user277428
Aug 1 at 17:29