答案1
一个相当简单的选择:
\documentclass[tikz,border=10pt,multi]{standalone}
\usetikzlibrary{positioning,arrows.meta,,bending}
\begin{document}
\begin{tikzpicture}
[
>/.tip={Triangle[length=7.5pt,width=5pt,bend]},
line width=1pt,
my circle/.style={minimum width=10mm, circle, draw},
my label/.style={above=10pt, anchor=mid}
]
\node (1) [my circle] {$1$};
\node (2) [my circle, right=75pt of 1] {$2$};
\path [postaction={draw, {>[sep=5pt,reversed]}-{<[sep=5pt]}}, draw] (1) -- (2) node [very near start, my label] {$\alpha$} node [very near end, my label] {$\beta$} ;
\path [->, draw] (2.south east) arc (-135:135:5mm) node [near end, my label] {$1-\beta$};
\path [->, draw] (1.south west) arc (-45:-315:5mm) node [near end, my label] {$1-\alpha$};
\end{tikzpicture}
\end{document}
答案2
也许是这样的?
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}[
node distance = 1cm and 2cm, >=latex,
state/.style={draw, thick, circle, minimum size=8mm, inner sep=0pt},
transitionA/.style args={#1}{very thick, ->, postaction={decorate},
decoration={markings,
mark=at position .8 with {\node[anchor=south,yshift=1pt] {#1};}}},
transitionB/.style args={#1}{very thick, postaction={decorate},
decoration={markings,
mark=at position .26 with {\arrow{>}},
mark=at position .2 with {\node[anchor=south,yshift=1pt] {#1};}}}
]
\node[state] (1) {$1$};
\node[state,right=of 1] (2) {$2$};
\draw [transitionA={$1-\alpha$}] (1.south west) arc (-45:-315:4mm);
\draw [transitionA={$1-\beta$}] (2.south east) arc (-135:135:4mm);
\draw [transitionB={$\alpha$}] (1.east) -- (2.west);
\draw [transitionB={$\beta$}] (2.west) -- (1.east);
\end{tikzpicture}
\end{document}
版本 2(编辑:使用自动机库)
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{arrows,automata}
\begin{document}
\begin{tikzpicture}[node distance=2cm,->,>=latex,auto,
every edge/.append style={thick}]
\node[state] (1) {$1$};
\node[state] (2) [right of=1] {$2$};
\path (1) edge[loop left] node{$1-\alpha$} (1)
edge[bend left] node{$\alpha$} (2)
(2) edge[loop right] node{$1-\beta$} (2)
edge[bend left] node{$\beta$} (1);
\end{tikzpicture}
\end{document}
答案3
请尝试以下操作:
\documentclass[tikz]{standalone}
\usetikzlibrary{automata,decorations.markings,positioning}
\begin{document}
\begin{tikzpicture}[
>=latex,
decoration = {markings,
mark=at position .3 with {\arrow {>}},
mark=at position .7 with {\arrowreversed {>} }
},
node distance=33mm]
\node[state] (n1) {1};
\node[state] (n2) [right=of n1] {2};
\path[->,every loop/.style={looseness=8}]
(n1) edge [postaction={decorate}] node [pos=0.3,above] {$\alpha$}
node [pos=0.7,above] {$\beta$} (n2)
(n1) edge [in=210,out=150,loop] node[above=11pt] {$1-\alpha$} ()
(n2) edge [in=-30,out=30, loop] node[above=11pt] {$1-\beta$} ();
\end{tikzpicture}
\end{document}
编辑:in
我通过定义循环和out
角度来 改变循环的外观,并简化状态之间的连接。