代码如下
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,automata,positioning}
\newcommand{\N}{\mathbb{N}} % natuerliche Zahlen
\newcommand{\Z}{\mathbb{Z}} % ganze Zahlen
\newcommand{\Q}{\mathbb{Q}} % rationale Zahlen
\newcommand{\R}{\mathbb{R}} % reelle Zahlen
\newcommand{\Prob}{\mathbb{P}} % Symbol fuer Wahrscheinlichkeitsmaß
\newcommand{\E}{\mathbb{E}} % Symbol fuer Erwartungswert
\newcommand{\QAt}{\mathbf{Q}_{A_{2}A_{2}}}
\newcommand{\QAo}{\mathbf{Q}_{A_{1}A_{1}}}
\newcommand{\QAot}{\mathbf{Q}_{A_{1}A_{2}}}
\newcommand{\QAto}{\mathbf{Q}_{A_{2}A_{1}}}
\newcommand{\QAtC}{\mathbf{Q}_{A_{2}C}}
\newcommand{\QAtw}{\mathbf{Q}_{A_{2}\{\omega\}}}
\newcommand{\QAow}{\mathbf{Q}_{A_{1}\{\omega\}}}
\newcommand{\I}{\mathbf{I}}
\newcommand{\vf}{\mathbf{v}}
\newcommand{\Df}{\mathbf{D}}
\newcommand{\af}{\pmb{\alpha}}
\newcommand{\eef}{\mathbf{e}}
\newcommand{\Psf}{\pmb{\Psi}}
\newcommand{\Phf}{\pmb{\Phi}}
\newcommand{\bef}{\pmb{\beta}}
\newcommand{\Pf}{\mathbf{P}}
\newcommand{\Qf}{\mathbf{Q}}
\newcommand{\mf}{\mathbf{m}}
\newcommand{\ef}{\pmb{\varepsilon}}
\newcommand{\Hf}{\mathbf{H}}
\newcommand{\Ef}{\mathbf{E}}
\newcommand{\Mf}{\mathbf{M}}
\newcommand{\Vf}{\mathbf{V}}
\newcommand{\gf}{\mathbf{g}}
\newcommand{\QSo}{\mathbf{Q}_{S' S'}}
\newcommand{\QSot}{\mathbf{Q}_{S' S''}}
\newcommand{\QSt}{\mathbf{Q}_{S'' S''}}
\newcommand{\UP}[2]{\makebox[0pt]{\smash{\raisebox{1.5em}{$\phantom{#2}#1$}}}#2}
\newcommand{\LF}[1]{\makebox[0pt]{$#1$\hspace{4.5em}}}
\newcommand{\zfo}{\mathbf{z}_{1}}
\newcommand{\zft}{\mathbf{z}_{2}}
\newcommand{\zf}{\mathbf{z}}
\begin{document}}
\begin{tikzpicture}[->,>=stealth,shorten >=1pt,auto,node distance=2.5cm,
semithick]
\tikzset{every state/.append style={fill=red,draw=none,text=white}}
\node[state] (A) {$\{\omega\}$};
\node[state] (B) [below=of A] {$A_{2}(1)$};
\node[state] (C) [below=of B] {$A_{1}(1)$};
\node[state] (D) [below=of C] {$\{\omega\}$};
\node[state] (F) [right=of B] {$A_{2}(2)$};
\node[state] (E) [above=of F] {$\{\omega\}$};
\node[state] (G) [below=of F] {$A_{1}(2)$};
\node[state] (H) [below=of G] {$\{\omega\}$};
\node[state] (J) [right=of F] {$A_{2}(m)$};
\node[state] (I) [above=of J] {$\{\omega\}$};
\node[state] (K) [below=of J] {$A_{1}(m)$};
\node[state] (L) [below=of K] {$\{\omega\}$};
\node[state] (M) [right=of J] {$A_{2}$\scriptsize(m+1)};
\path (B) edge node {$\mathbf{Q}_{A_{2}\{\omega\}}$} (A)
edge [loop left] node {$\QAt$} (B)
edge node {$\QAto$} (C)
(C) edge [loop left] node {$\QAo$} (C)
edge node {$\mathbf{Q}_{A_{1}\{\omega\}}$} (D)
edge [right] node {$\QAot$} (F)
(F) edge node {$\mathbf{Q}_{A_{2}\{\omega\}}$} (E)
edge [loop left] node {$\QAt$} (F)
edge node(aux) {$\QAto$} (G)
(G) edge [loop left] node {$\QAo$} (G)
edge node {$\mathbf{Q}_{A_{1}\{\omega\}}$} (H)
(J) edge node {$\mathbf{Q}_{A_{2}\{\omega\}}$} (I)
edge [loop left] node {$\QAt$} (J)
edge node {$\QAto$} (K)
(K) edge [loop left] node {$\QAo$} (K)
edge node {$\mathbf{Q}_{A_{1}\{\omega\}}$} (L)
edge [right] node {$\QAot$} (M)
(M) edge [loop left] node {$\I$} (M);
\node[right=2mm of aux,font=\bfseries\Huge]{\dots};
\end{tikzpicture}
\end{document}
谢谢你的帮助
答案1
以下是一些起点:
\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{automata,chains,positioning}
\begin{document}
\begin{tikzpicture}[
auto,
node distance = 14mm,
start chain = going right,
state/.append style = {
thick,
minimum width=3em,
on chain,
fill=red,
draw=none,
text=white
},
]
\node (s0)[state] {$1$};
\node (s1)[state] {$2$};
\node (s2)[state] {$3$};
\node (s3)[state] {$r-2$};
\node (s4)[state] {$r-1$};
\draw[->] (s0) edge[bend left] node (a1) {p} (s1)
(s1) edge[bend left] node (b1) {q} (s0)
(s1) edge[bend left] node (a2) {p} (s2)
(s2) edge[bend left] node (b2) {q} (s1)
(s3) edge[bend left] node (a4) {p} (s4)
(s4) edge[bend left] node (b4) {q} (s3)
;
\node[state,node distance=3cm] (a) [below=of s2] {$\alpha$};
\draw[->] (s4.south west) edge node {p} (a);
\draw[<-] (a) edge node {q} (s0.south east);
\node[node distance=0.3cm,right=of s2] {$\ldots$};
\path (a) edge [loop below] node {Q} (a);
\end{tikzpicture}
\end{document}
答案2
编辑:一个新版本。我做了一些改变。你可以改变字符的大小,类似地,有一个大的页和和大1。
\documentclass[a4paper,12pt]{article}
\usepackage{tikz, tikz-cd,amsmath}
\usepackage{graphicx}
\newcommand*\nci[1]{\tikz[baseline=(char.base)]{
\node[shape=circle, draw=red, fill=red, draw,inner sep=7pt] (char) {#1};}}
\usepackage{adjustbox}
\begin{document}
\adjustbox{scale=.5,center}{%
\begin{tikzcd}[column sep=1.6in,row sep=1.1in]
\nci{\textcolor{white}{\resizebox{.5cm}{!}{1}}}\arrow[r, "\resizebox{.5cm}{!}{$p$}", bend left=15] \arrow[rrd, "q"'] & \nci{\textcolor{white}{2}} \arrow[l, "q", bend left=15] \arrow[r, "p", bend left=15] & \nci{\textcolor{white}{3}}\cdots \arrow[l, "q", bend left=15] & \qquad \cdots \nci{\textcolor{white}{$r-2$}} \arrow[r, "p", bend left=10] & \nci{\textcolor{white}{$r-1$}} \arrow[lld, "p"'] \arrow[l, "q", bend left=10] \\
& & \alpha & &
\end{tikzcd}
}
\end{document}
这里有一个版本tikz-cd
只需与您想要的进行比较即可。当然,您可以增加字符的大小等。
\documentclass[a4paper,12pt]{standalone}
\usepackage{tikz-cd,amsmath}
\begin{document}
\begin{tikzcd}[column sep=1.6in,row sep=1.1in]
1 \arrow[r, "p", bend left=15] \arrow[rrd, "q"'] & 2 \arrow[l, "q", bend left=15] \arrow[r, "p", bend left=15] & 3\cdots \arrow[l, "q", bend left=15] & \qquad \cdots r-2 \arrow[r, "p", bend left=10] & r-1 \arrow[lld, "p"'] \arrow[l, "q", bend left=10] \\
& & \alpha & &
\end{tikzcd}
\end{document}
答案3
这是一个使用chain
TikZ 概念的解决方案(参见 3.0.1a 手册第 257 页第 19 节)。第一个字符串定义节点1
; 2
; 3
; ...;n-1
和n-2
。第二个链重用这些节点并将箭头放在相反的方向。
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{graphs,quotes}
\begin{document}
\begin{tikzpicture}
\graph[grow right=20mm,edges=bend left,edge node={node [yshift=3pt, midway]{p}}] {
1 -> 2 -> 3-!-4/$\cdots$ -!- 5/{$n-2$}->6/{$n-1$} ;
};
\graph[use existing nodes,edges=bend right,grow right=20mm,edge node={node [yshift=3pt, midway]{q}}] {
1 <- 2 <- 3-!-4/$\cdots$ -!- 5/{$n-2$}<-6/{$n-1$} ;
};
\node at (5,-2)(a){a}edge [loop below] node {s} ();;
\graph[use existing nodes,edges={bend right=10}]{ 1.south->[edge label'=q](a)<-[edge label=p]6.south;};
\end{tikzpicture}
\end{document}