答案1
使用 TikZfit
库。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture}[
every node/.style = {
draw,rounded corners,
minimum width=3cm
}]
\node (A) {A};
\node[below of=A] (B) {B};
\node[below of=B] (C) {C};
\node[below of=C] (D) {D};
\node[below of=D] (E) {E};
\node[below of=E] (F) {F};
\draw (A) edge[->] (B);
\draw (B) edge[->] (C);
\draw (C) edge[->] (D);
\draw (D) edge[->] (E);
\draw (E) edge[->] (F);
\node[fit=(A) (B) (C) (D)] {};
\node[fit=(E) (F)] {};
\end{tikzpicture}
\end{document}