I'm trying to draw specific arrows from table cells to nodes. This is what I have done so far:
I'm trying to get this:
This is my code:
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}
\usetikzlibrary{arrows,automata}
\begin{document}
\begin{tikzpicture}[->,>=stealth,node distance=4cm,semithick]
\tikzstyle{every state}=[draw=black,text=black,minimum size=2cm]
\node[state]at (0,0)(0) {
\begin{tabular}{|c|}
\hline
\rowcolor{gray!50}
5 \\\hline
13 \\\hline
14 \\\hline
\end{tabular}
};
\node[state]at (-4,-4)(1) {
\begin{tabular}{|c| }
\hline
\cellcolor{gray!50} 1 \\\hline
11 \\\hline
12 \\\hline
\end{tabular}
};
\node[state](2) at (-2,-8){
\begin{tabular}{|c| }
\hline
\cellcolor{gray!50} 2 \\\hline
17 \\\hline
18 \\\hline
\end{tabular}
};;
\node[state](3) at (4,-4) {
\begin{tabular}{|c| }
\hline
\cellcolor{gray!50} 3 \\\hline
15 \\\hline
16 \\\hline
\end{tabular}
};
\node[fill=gray!50,state](4) at (6,-8) {4 jump };
%\node[fill=gray!50,draw=black,text=black,minimum size=2cm](6) at (6,-8) { };
\node[draw=black,thick,circle,inner sep=4.5pt](6) at (6,-8) {4 jump };
\node[state](5) at (-6,0) {
\begin{tabular}{|c| }
\hline
\cellcolor{gray!50} 5 \\\hline
17 \\\hline
18 \\\hline
\end{tabular}
};
\draw (0) -- (1);
\draw (0) -- (3);
\draw (1) -- (3);
\draw (1) -- (2);
\draw (2) -- (4);
\draw[transform canvas={xshift=4pt,yshift=2pt}] (2)--(1);
\draw (3) -- (2);
\draw (3) -- (4);
\draw (5) -- (1);
\draw (5) -- (3);
\end{tikzpicture}
\end{document}
Is there a way to do that?





matrixinstead of the circular nodes with tabulars inside you can address the individual cells easily. You can then draw a circle around them if you really want... otherwise, you can usetikzmarkhttp://tex.stackexchange.com/a/295987/38080 – Rmano Jan 19 '17 at 13:36