我怎样才能在图表的最后添加点

我怎样才能在图表的最后添加点

我想在图表的末尾添加点,显示无限。但是,我试了几次,都没有成功。问题出在带有 ** 的代码上,其他部分都是正确的。谢谢 我的代码如下:

\begin{figure}[htbp]
\begin{center}
\begin{tikzpicture}[->, >=stealth, auto, semithick, node distance=3cm]
\tikzstyle{every state}=[fill=white,draw=blue,thick,text=black,scale=1]

\node[state]    (0') at (0,12)  {$0\textprime$};
\node[state]    (0) at (0,9)  {$0$};



\node[state]    (1') at (3,12)  {$1\textprime$};
\node[state]    (1) at (3,9)  {$1$};



\node[state]    (2') at (6,12)  {$2\textprime$};
\node[state]    (2) at (6,9)  {$2$};



\node[state]    (3') at (9,12)  {$3\textprime$};
\node[state]    (3) at (9,9)  {$3$};


\node[state]    (4') at (12,12)  {$4\textprime$};
\node[state]    (4)  at (12,9)   {$4$};

**\node[dots]     (d) at  (15,12)  {$\dots$};
\node[dots]     (d) at  (15,9)   {$\dots$};**





\path
(0')  edge[bend left]     node{$\lambda$} (1')
      edge[bend left]     node{$\beta$} (0)

(0)   edge[bend left]     node{$\alpha$} (0')
      edge[bend left]     node{$\lambda$} (1)


(1)   edge[bend left]     node{$\mu$}     (0)
      edge[bend left]     node{$\lambda$} (2)
      edge[bend left]     node{$\alpha$}  (1')

(1')  edge[bend left]     node{$\mu$} (0')
      edge[bend left]     node{$\beta$} (1)
      edge[bend left]     node{$\lambda$} (2')

(1)   edge[bend left]     node{$\mu$}     (0)
      edge[bend left]     node{$\alpha$}  (1')
      edge[bend left]     node{$\lambda$} (2)

(2)   edge[bend left]     node{$\mu$}     (1)
      edge[bend left]     node{$\lambda$} (3)
      edge[bend left]     node{$\alpha$}  (2')

(2')  edge[bend left]     node{$\beta$}     (2)
      edge[bend left]     node{$\mu$} (1')
      edge[bend left]     node{$\lambda$}  (3')

(3')  edge[bend left]     node{$\mu$} (2')
      edge[bend left]     node{$\lambda$}  (4')
      edge[bend left]     node{$\beta$}    (3)

(3)   edge[bend left]     node{$\mu$}     (2)
      edge[bend left]     node{$\alpha$}  (3')
      edge[bend left]     node{$\lambda$} (4)
(4)   edge[bend left]     node{$\mu$}     (3)
      edge[bend left]     node{$\alpha$}  (4')

(4')  edge[bend left]     node{$\beta$}    (4)
      edge[bend left]     node{$\mu$}      (3')
;

\end{tikzpicture}
\end{center}

\end{figure}
\clearpage

答案1

您的图表有很多重复的内容。最好使用循环。

最后,我将点放在每行最后一个节点的右边。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}
\begin{document}
\begin{tikzpicture}[
  >=stealth,
  semithick,
  every state/.style={draw=blue,thick}
  ]
  \foreach \i in {0,...,4}
  {
    \node[state] (n-\i) at (3*\i,0) {$\i$};
    \node[state] (p-\i) at (3*\i,3) {$\i'$};

    \draw[->] (n-\i) to[bend left] node[left]  {$\alpha$} (p-\i);
    \draw[->] (p-\i) to[bend left] node[right] {$\beta$}  (n-\i);
  }
  \foreach \x in {n,p} {
    \foreach \i[remember=\i as \last (initially 0)] in {1,...,4} {
      \draw[->] (\x-\last) to[bend left] node[above] {$\lambda$} (\x-\i);
      \draw[->] (\x-\i)    to[bend left] node[below] {$\mu$}     (\x-\last);
    }
  }
  \node[right=.1cm of n-4] {$\dots$};
  \node[right=.1cm of p-4] {$\dots$};
\end{tikzpicture}
\end{document}

在此处输入图片描述


如果您不想手动放置节点,可以使用矩阵。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{automata,matrix,positioning}
\begin{document}
\begin{tikzpicture}[
  >=stealth,
  semithick,
  every state/.style={draw=blue,thick}
  ]
  \matrix[matrix of nodes,nodes=state,row sep=2cm,column sep=2cm] (m) {
    0' & 1' & 2' & 3' & 4' \\
    0  & 1  & 2  & 3  & 4  \\
  };
  \foreach \c in {1,...,5} {
    \draw[->] (m-2-\c) to[bend left] node[left]  {$\alpha$} (m-1-\c);
    \draw[->] (m-1-\c) to[bend left] node[right] {$\beta$}  (m-2-\c);
  }
  \foreach \r in {1,2} {
    \foreach \c[remember=\c as \last (initially 1)] in {2,...,5} {
      \draw[->] (m-\r-\last) to[bend left] node[above] {$\lambda$} (m-\r-\c);
      \draw[->] (m-\r-\c)    to[bend left] node[below] {$\mu$}     (m-\r-\last);
    }
  }
  \node[right=.1cm of m-1-5] {$\dots$};
  \node[right=.1cm of m-2-5] {$\dots$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容