![箭头不会出现](https://linux22.com/image/430025/%E7%AE%AD%E5%A4%B4%E4%B8%8D%E4%BC%9A%E5%87%BA%E7%8E%B0.png)
我画了下面的DFA,但不知为何,连接节点4和节点3的箭头不显示箭头。有趣的是,如果我删除从节点3到节点4的另一边的边,箭头就会显示出来。
如果有人能解释一下那就太好了。我觉得这可能是因为我试图用蛮力来创建外边缘,而且可能有更“正确”的方法来做到这一点。
我将非常感激您提供的任何帮助。提前致谢!
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[thinlines]{easytable}
\usepackage{mathtools}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{permute}
\usepackage{xparse}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{mdwlist}
\usepackage{tabularx,colortbl}
\usepackage[hmargin = 1.25 in, bmargin=1 in]{geometry}
%\usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
\usepackage{amssymb}
\usepackage{enumitem}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows,calc}
\usepackage{eqparbox}
\newcommand{\zerotext}[2][0pt]{\makebox[#1][l]{\qquad#2}}
\usepackage{circledsteps}
\usepackage{icomma}
\usepackage{xcolor}
\usepackage{pifont}
\setlength{\parindent}{0em}
\tikzset{
->, % makes the edges directed
>=stealth', % makes the arrow heads bold
node distance=3cm, % specifies the minimum distance between two nodes. Change if necessary.
every state/.style={thick, fill=gray!10}, % sets the properties for each 'state' node
initial text=$ $, % sets the text that appears on the start arrow
}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node[state, accepting, initial ] (q1) {$1$};
\node[state, accepting, right of=q1] (q2) {$2$};
\node[state, accepting, above of=q2] (q3) {$3$};
\node[state, accepting, below of=q2] (q4) {$4$};
\node[state, accepting, right of=q2] (q5) {$5$};
%\tikzset{mystyle/.style={->,relative=false,in=0,out=0}}
\draw
(q1) edge[bend left, left] node{$a$} (q3)
(q1) edge[above] node{$b$} (q2)
(q1) edge[bend right, left] node{$c$} (q4)
(q2) edge[above] node{$b$} (q5)
(q2) edge[bend left, left] node{$a$} (q3)
(q2) edge[bend left, right] node{$c$} (q4)
[->] (q4) to [out=180,in=-90] ($(q1)-(2,0)$) node at (-2.15,0) {$a$} to [out=90, in=180] (q3)
[->] (q3) to [out=0,in=90] ($(q5)+(2,0)$) node at (8.15,0) {$c$} to [out=-90, in=0] (q4)
(q3) edge[bend left, right] node{$b$} (q2)
(q3) edge[bend left, right] node{$a$} (q5)
(q4) edge[bend left, left] node{$b$} (q2)
(q4) edge[bend right, right] node{$c$} (q5)
(q5) edge[loop right, right] node{$a,b,c$} (q6);
\end{tikzpicture}
\end{center}
\end{document}
答案1
一条路径在末端只有一个箭头。该图之所以有效,是因为该->
事物被传递给edge
,从而创建了一个不同的路径在当前路径的末尾被划掉。因此,基本上,删除以 开头的两行[->]
(无论如何,这是默认的),并将它们添加到新路径的末尾:
\draw
(q1) edge[bend left, left] node{$a$} (q3)
(q1) edge[above] node{$b$} (q2)
(q1) edge[bend right, left] node{$c$} (q4)
(q2) edge[above] node{$b$} (q5)
(q2) edge[bend left, left] node{$a$} (q3)
(q2) edge[bend left, right] node{$c$} (q4)
(q3) edge[bend left, right] node{$b$} (q2)
(q3) edge[bend left, right] node{$a$} (q5)
(q4) edge[bend left, left] node{$b$} (q2)
(q4) edge[bend right, right] node{$c$} (q5)
(q5) edge[loop right, right] node{$a,b,c$} (q6);
\draw (q4) to [out=180,in=-90] ($(q1)-(2,0)$) node at (-2.15,0) {$a$} to [out=90, in=180] (q3);
\draw (q3) to [out=0,in=90] ($(q5)+(2,0)$) node at (8.15,0) {$c$} to [out=-90, in=0] (q4);