答案1
这并不那么难decorations.markings
:
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\draw (0,0) grid (5,5);
\foreach \i in {0,...,5}
\foreach \j in {0,...,5}
\fill (\i,\j) circle (1pt);
\draw[ultra thick,red,postaction=decorate,decoration={
markings,
mark=between positions {0.5/11} and {10.5/11} step {1/11} with {
\draw[-stealth,very thin] (-.4,.1)--(.4,.1);}
}] (0,2) -- (2,2) |- (1,1) |- (4,5);
\fill[red] (0,2) circle (2pt) node[left] {Identity}
(4,5) circle (2pt) node[above] {End of path};
\end{tikzpicture}
\end{document}