在 tikz 中彼此之间添加两个节点?

在 tikz 中彼此之间添加两个节点?

我是 tkiz 新手,我需要生成一个像附图中的图形。这是生成图形左侧的 Wml 代码。如何添加带有箭头的右侧部分??在此处输入图片描述

       \documentclass[tikz,border=3.14mm]{standalone}
     \usetikzlibrary{positioning,shapes.geometric,shapes.misc}
      \begin{document}
      \begin{tikzpicture}
   \begin{scope} [every node/.append style={draw},cifi/.style={inner  sep=1pt,circle,draw,fill=#1}]

     \node[cifi=green] (T1) {$T_1$};
        \node[cifi=green,right=4mm of T1,yshift=1mm] (T4) {$T_4$};
         \node[cifi=green,below right=3mm of T4] (T5) {$T_5$};
        \node[cifi=green,below left=3mm and 2mm of T5] (T7) {$T_7$};
     \node[cifi=orange!60,below left=4mm and 6mm of T4] (T3) {$T_3$};
       \node[cifi=orange!60,left=3mm of T3] (T2) {$T_2$};
    \node[cifi=orange!60,below right=3mm and 2mm of T2] (T6) {$T_6$};
       \end{scope}
         \begin{scope}[thick,>=latex,font=\small]
        \draw (T1) -- (T4) -- (T3) -- (T2) -- (T6) -- (T3) -- (T7);
         \end{scope}
        \draw[dashed] plot[smooth cycle] coordinates      {([xshift=-3mm,yshift=1mm]T2.north west)
         ([xshift=2mm,yshift=1mm]T3.north east) ([yshift=-1mm,xshift=1mm]T6.south east)
      ([yshift=-1mm,xshift=-1mm]T6.south west)};

        \end{tikzpicture}
     \end{document}

答案1

这是一个起点。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning,shapes.arrows,backgrounds}
\tikzset{ % https://tex.stackexchange.com/a/218929/121799
shadowed/.style={preaction={transform canvas={shift={(2pt,-1pt)}},draw=gray,very thick}},
  shadowed/.style={preaction={
      transform canvas={shift={(2pt,-1pt)}},draw opacity=.2,#1,preaction={
        transform canvas={shift={(3pt,-1.5pt)}},draw opacity=.1,#1,preaction={
          transform canvas={shift={(4pt,-2pt)}},draw opacity=.05,#1,
        }}}},
}
\begin{document}
\begin{tikzpicture}[cifi/.style={inner  sep=1pt,circle,draw,#1},font=\sffamily,
bcify/.style={cifi={top color=blue!50,bottom color=blue!50!black},text=white},
pcify/.style={cifi={top color=purple!50,bottom color=purple!50!black},text=white},
gcify/.style={cifi={top color=gray!50,bottom color=gray!20},text=white},
ocify/.style={cifi={top color=orange!50,bottom color=orange}}]
\begin{scope}[every node/.append style={draw},local bounding box=left]
\node[bcify] (T1) {$T_1$};
\node[bcify,right=4mm of T1,yshift=1mm] (T4) {$T_4$};
\node[bcify,below right=3mm of T4] (T5) {$T_5$};
\node[bcify,below left=3mm and 2mm of T5] (T7) {$T_7$};
\node[pcify,below left=4mm and 6mm of T4] (T3) {$T_3$};
\node[pcify,left=9mm of T3] (T2) {$T_2$};
\node[pcify,below right=9mm and 6mm of T2] (T6) {$T_6$};
\begin{scope}[thick,>=latex,font=\small,on background layer]
\draw[shadowed={draw=gray}] (T1.center) -- (T4.center) -- (T3.center) -- (T2.center) -- (T6.center) -- (T3.center) -- (T7.center);
\draw[dashed] plot[smooth cycle] coordinates      {([xshift=-3mm,yshift=1mm]T2.north west)
 ([xshift=2mm,yshift=1mm]T3.north east) ([yshift=-1mm,xshift=1mm]T6.south east)
([yshift=-1mm,xshift=-1mm]T6.south west)};
\end{scope}
\end{scope}
\begin{scope}[every node/.append style={draw},local bounding
box=right,xshift=8cm]
\node[bcify] (T1) {$T_1$};
\node[bcify,right=4mm of T1,yshift=1mm] (T4) {$T_4$};
\node[bcify,below right=3mm of T4] (T5) {$T_5$};
\node[bcify,below left=3mm and 2mm of T5] (T7) {$T_7$};
\node[gcify,below left=4mm and 6mm of T4] (T3) {$T_3$};
\node[gcify,left=9mm of T3] (T2) {$T_2$};
\node[gcify,below right=9mm and 6mm of T2] (T6) {$T_6$};
\begin{scope}[thick,>=latex,font=\small,on background layer]
\draw[shadowed={draw=gray}] (T1.center) -- (T4.center) -- (T3.center) --  (T7.center);
\draw[gray,shadowed={draw=gray!30}] (T2.center) -- (T6.center) -- (T3.center) -- (T2.center);
\draw[dashed] plot[smooth cycle] coordinates      {([xshift=-3mm,yshift=1mm]T2.north west)
 ([xshift=2mm,yshift=1mm]T3.north east) ([yshift=-1mm,xshift=1mm]T6.south east)
([yshift=-1mm,xshift=-1mm]T6.south west)};
\end{scope}
\node[ocify] at (barycentric cs:T2=1,T3=1,T6=1){$T_{236}$};
\end{scope}
\path (left.east) -- (right.west) node[midway,single arrow,top color=blue!50,bottom color=blue,minimum
height=3.5cm,label=above:Eliminate matches]{};

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容