答案1
我认为这或多或少就是您正在寻找的:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{arrows.meta}
\colorlet{mycolor}{pink!50!red}
\tikzset{
mynode/.style={
draw, circle,
#1,
dashed, very thick,
align=center,
text=black,
inner sep=0pt
}
}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of nodes,column sep=0pt,
column sep=4pt,
row 1/.style={nodes={mynode={white}}},
row 3/.style={nodes={mynode={mycolor}}},
nodes={text width=width{-20}},
] (M) {
& 1 & \phantom{-}5 & \phantom{-}4 &[4pt] \phantom{-}20\\
|[mynode={white}]|-5 & & |[mynode={mycolor}]|-5 & |[mynode={mycolor}]|-5 & |[mynode={mycolor}]|-20\\[2ex]
& 1 & 0 & 4 & 0\\
};
\draw ([yshift=-2ex]M-2-1.south west) -- ([shift={(2pt,-2ex)}]M-2-5.south east);
\draw ([xshift=-8pt]M-1-2.north west) -- ([shift={(-8pt,-1ex)}]M-3-2.south west);
\draw[thick] ([shift={(-7pt,1.5ex)}]M-3-5.north west) -- ([shift={(-7pt,-1ex)}]M-3-5.south west);
\begin{scope}[ shorten >=1pt, shorten <=1pt,
mycolor, -Stealth]
\draw (M-1-2) -- (M-3-2);
\draw (M-3-2) -- (M-2-3);
\draw (M-2-3) -- (M-3-3);
\draw (M-3-3) -- (M-2-4);
\draw (M-2-4) -- (M-3-4);
\draw (M-3-4) -- (M-2-5);
\draw (M-2-5) -- (M-3-5);
\end{scope}
\end{tikzpicture}
\end{document}