答案1
快速解决方案
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\fill (0,0) circle (1pt) node[below] {$n$} (2,0) circle (1pt) node[below] {$n+1$} (-2,0) circle (1pt) node[below] {$n-1$};
\draw[-latex] (0,0)--(-1,0) node[above] {$n$};
\draw[-latex] (0,0)--(1,0) node[above] {$a(n)$};
\draw (-3,0)--(3,0);
\end{tikzpicture}
\end{document}
答案2
替代:
\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{arrows,decorations.markings, positioning, quotes}
\begin{document}
\begin{tikzpicture}[
node distance =22mm,
->-/.style = {decoration={markings,
mark=at position 0.5 with {\arrow{>}}},postaction={decorate}},
dot/.style = {circle, fill, inner sep=2pt, node contents={}}
]
\node (d1) [dot,label=below:$n-1$];
\node (d2) [dot,label=below:$n$, right=of d1];
\node (d3) [dot,label=below:$n+1$, right=of d2];
\path (d2) edge [->-, "$n$" '] (d1)
(d2) edge [->-, "$a(n)$"] (d3);
\draw (d1.west) -- + (-1,0)
(d3.east) -- + ( 1,0);
\end{tikzpicture}
\end{document}