如何连接图中所示的两个节点?

如何连接图中所示的两个节点?

我想连接两个节点(n4 和 n10),如图所示在此处输入图片描述

我该怎么做呢?

\begin{figure}
    \begin{center}
        \begin{tikzpicture}[font=\sffamily,boxed/.style={minimum width=1.7cm,minimum height=1cm,draw,thick,text width=2.5cm,text centered},node distance=.4cm] 
         \begin{scope}[local bounding box=upper]
          \begin{scope}[start chain=1 going below,every join/.style={-latex,thick},frm/.style={boxed,on chain=1,join}]
           \node[on chain=1](n0) {\scriptsize Training Sequence};
           \node[frm](n3) {\scriptsize Construct dhjkfshfkjsf cardinality};
           \node[frm](n4) {\scriptsize feature Construction with respect to each set };
          \end{scope} 

           \node[boxed,right=0.7cm of n3] (n10) {\scriptsize Train and construct GAN Model with GEI pairs}; 
           \node at (n0-|n10) (n9) {\scriptsize Test Sequence};
           \node[boxed,right=0.7cm of n4] (n11) {\scriptsize  feature Construction after fusing };
         \end{scope} 

          \begin{scope}[every edge/.style={draw,-latex,thick}]  
           \path 
           (n9) edge (n10)
           (n10) edge (n11)
           (n4.east) edge (n10.west);
          \end{scope}
        \end{tikzpicture}
    \end{center}
    \caption{Block diagram of the proposed gait recognition approach}
    \label{fig:block2}
\end{figure}

答案1

像这样?

\documentclass{article} 
\usepackage{tikz} 
\usetikzlibrary{chains}
\begin{document}
\begin{figure}
    \begin{center}
        \begin{tikzpicture}[font=\sffamily\scriptsize,boxed/.style={minimum width=1.7cm,minimum height=1cm,draw,thick,text width=2.5cm,text centered},node distance=.4cm] 
         \begin{scope}[local bounding box=upper]
          \begin{scope}[start chain=1 going below,every join/.style={-latex,thick},frm/.style={boxed,on chain=1,join}]
           \node[on chain=1](n0) {Training Sequence};
           \node[frm](n3) {Construct dhjkfshfkjsf cardinality};
           \node[frm](n4) {feature Construction with respect to each set };
          \end{scope} 

           \node[boxed,right=0.7cm of n3] (n10) {Train and construct GAN Model with GEI pairs}; 
           \node at (n0-|n10) (n9) {Test Sequence};
           \node[boxed,right=0.7cm of n4] (n11) { feature Construction after fusing };
         \end{scope} 

          \begin{scope}
           \path (n4.east) -- coordinate (aux) (n10.west);
           \path[draw,-latex,thick]
           (n9) edge (n10)
           (n10) edge (n11)
           (n4.east) -| (aux) |- (n10.west);
          \end{scope}
        \end{tikzpicture}
    \end{center}
    \caption{Block diagram of the proposed gait recognition approach}
    \label{fig:block2}
\end{figure}
\end{document}

在此处输入图片描述

不过,我感觉,有了 ,代码会更简洁matrix

\documentclass{article} 
\usepackage{tikz} 
\usetikzlibrary{matrix}
\begin{document}
\begin{figure}
\centering
 \begin{tikzpicture}[font=\sffamily\scriptsize,
    boxed/.style={minimum width=1.7cm,minimum height=1cm,
    draw,thick,text width=2.5cm,text centered,anchor=center}] 
   \matrix[matrix of nodes,row 2/.style={nodes=boxed},
    row 3/.style={nodes=boxed},
    column sep=0.7cm,row sep=0.4cm] (mat){
     Training Sequence & Test Sequence \\
     Construct dhjkfshfkjsf cardinality & Train and construct GAN Model with GEI
     pairs\\
     feature Construction with respect to each set & 
     feature Construction after fusing\\
   };
    \path[draw,-latex,thick]
     foreach \X in {1,2} {
     foreach \Y in {1,2} {(mat-\X-\Y) edge (mat-\the\numexpr\X+1\relax-\Y)}}  
    (mat-3-1.east) -| (mat.center) |- (mat-2-2.west);
 \end{tikzpicture}
\caption{Block diagram of the proposed gait recognition approach}
\label{fig:block2}
\end{figure}
\end{document}

在此处输入图片描述

答案2

第一个 @Schrödinger 猫答案的一个小变化。使用chains库宏join

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains,
                positioning}

\makeatletter
\tikzset{suspend join/.code={\def\tikz@after@path{}}}
\makeatother

\begin{document}
    \begin{figure}
    \centering
    \begin{tikzpicture}[
node distance = 4mm and 8mm, 
  start chain = going below,
  base/.style = {font=\sffamily\scriptsize, text width=2.5cm, align= center,
                 on chain, join=by ->},
   box/.style = {base, draw, thick ,minimum height=1cm},
                        ]
\node (n11) [base]  {Training Sequence};
\node (n12) [box]   {Construct dhjkfshfkjsf cardinality};
\node (n13) [box]   {feature Construction with respect to each set };
%
\node (n21) [base, suspend join, 
             right=of n11]    {Test Sequence};
\node (n22) [box]   {Train and construct GAN Model with GEI pairs};
\node (n23) [box]   {Feature Construction after fusing };

\draw[->]   (n13.east) -- ++ (0.4,0) |- (n22);
    \end{tikzpicture}
\caption{Block diagram of the proposed gait recognition approach}
\label{fig:block2}
    \end{figure}
\end{document}

在此处输入图片描述

相关内容