I want to draw a graphic like this one:
But the vertical rectangle split does not have the same size (the horizontal one works OK). How to ensure the width and height with the same size?
MWE:
\documentclass[border=10pt]{standalone}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
positioning,
shapes.multipart}
\newlength\MinimumWidth
\setlength{\MinimumWidth}{\widthof{00}}
\tikzset{
arr/.style={{Circle[length=2pt 4, sep=0pt -4]}-Stealth},
arity/.style={
rectangle split,
rectangle split parts=#1+1,
rectangle split horizontal,
rectangle split empty part width=6mm,
minimum height=6mm,
text width=\MinimumWidth, align=center,% <--- NOTE
draw,
on chain},
arityv/.style={
rectangle split,
rectangle split parts=#1+1,
rectangle split every empty part={},
rectangle split empty part height=height("I"),
minimum height=6mm,
text height=height("I"),
text width=\MinimumWidth, align=center,% <--- NOTE
draw,
on chain},
box/.style = {draw, text width=#1, minimum size=#1, inner sep=0pt},
box/.default = 4mm
}
\begin{document}
\begin{tikzpicture}[
node distance = 8mm and 7mm,
start chain = on chain,
]
\node[arity=0, box, label=head] (a0) {};
\foreach \labela/\val [count=\i from 0, count=\j] in {7/,7/,88/,12/,13/,0/-1}%
{
\ifnum \i=1
\node[arity=1,red] (a\j) {\labela\nodepart{two}\val};
\draw[arr] (a\i.two north |- a\i.east) -- (a\j);
\else
\node[arity=1,blue] (a\j) {\labela\nodepart{two}\val};
\draw[arr] (a\i.two north |- a\i.east) -- (a\j);
\fi
}
\node[arity=0, box, label=head,
below=of a0] (b0) {};
\foreach \labela/\val [count=\i from 0, count=\j] in {17/,27/,1/,2/,3/,0/-1}%
{
\ifnum \i=1
\node[arityv=1,red] (b\j) {\labela\nodepart{two}\val};
\draw[arr] (b\i.two north |- b\i.two east) -- (b\j.two);
\else
\node[arityv=1,blue] (b\j) {\labela\nodepart{two}\val};
\draw[arr] (b\i.two north |- b\i.two east) -- (b\j.two);
\fi
}
\end{tikzpicture}
\end{document}