如何更改顶点样式

如何更改顶点样式

我希望最终状态与非最终状态的大小相同。最终状态和非最终状态之间的唯一区别应该是最终状态中是否存在双圆。

有谁知道如何做到这一点?

这是代码:

              \documentclass{article}
               \usepackage{geometry}
              \usepackage{tikz}
               \usetikzlibrary{arrows.meta,
chains,
fit,
positioning,
quotes}

                    \begin{document}
                \begin{center}
                   \begin{tikzpicture}[
    node distance = 12mm and 12mm,
    start chain = going right,
    arr/.style = {draw, semithick, rounded corners, -Straight Barb},
    N/.style = {draw, circle, fill=none, minimum size=1pt, outer sep=3pt,
        font=\tiny},
    EN/.style = {circle, draw,double,double distance=1.5pt, inner sep=0pt, outer sep=0.1pt,
        fit={#1}, node contents={}},
    every edge/.style = {draw, arr},
    ]
    % position the nodes a...d
    \coordinate[label=left:I] (a);
    \node (b) [N, right=of a] {$q_1$};
    \node (c) [N, above right=of b] {$q_2$};
    % position the nodes d...i
    \begin{scope}[nodes={on chain}]
    \node (d) [N, below right=of c] {$q_3$};
    \foreach \i in {e, f,...,i}
    \node (\i) [N] {$q_\i$};
    \end{scope}
    \node (ei) [EN=(i)];
    \path   (a) edge                    (b)
    (b) edge["$\varepsilon$"]   (c)
    (c) edge["$\varepsilon$"]   (d)
    (d) edge["0"]               (e)
    (e) edge["$\varepsilon$"]   (f)
    (f) edge["0"]               (g)
    (g) edge["$\varepsilon$"]   (h)
    (h) edge["1"]               (ei)
    ;
    \draw[arr]  (ei) |- ([yshift=45mm] b.north west)
    to ["$\varepsilon$" '] (b.north west);
    %%%%
    \begin{scope}[nodes={on chain}]
    \node (j) [N, above right=of c] {$q_j$};
    \foreach \i in {k, l, m}
    \node (\i) [N] {$q_\i$};
    \end{scope}
    \node (em) [EN=(m)];
    \path   (c) edge["$\varepsilon$"]   (j)
    (j) edge["1"]               (k)
    (k) edge["$\varepsilon$"]   (l)
    (l) edge["0"]               (em);
    \draw[arr]  (em) |- ([yshift=42mm] b.north)
    to ["$\varepsilon$"] (b);
    %%%%
    \begin{scope}[nodes={on chain}]
    \node (n) [N, below right=of b] {$q$};
    \foreach \i in {o, p,...,s}
    \node (\i) [N] {$q_\i$};
    \end{scope}
    \node (es) [EN=(s)];
    \path   (b) edge["$\varepsilon$"]   (n)
    (n) edge["0"]               (o)
    (o) edge["$\varepsilon$"]   (p)
    (p) edge["1"]               (q)
    (q) edge["$\varepsilon$"]   (r)
    (r) edge["0"]               (es);
    \draw[arr]  (es) |- ([yshift=-22mm] b.south)
    to ["$\varepsilon$"] (b);
    \end{tikzpicture}
\end{center}
         \end{document}

这是我得到的输出(最终状态为三重圆):

在此处输入图片描述

答案1

我猜你可能喜欢(或者你追求)以下解决方案

在此处输入图片描述

\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                fit,
                positioning,
                quotes}

\begin{document}
\begin{center}
    \begin{tikzpicture}[
node distance = 12mm and 12mm,
  start chain = going right,
   arr/.style = {draw, semithick, rounded corners, -Straight Barb},
     N/.style = {circle, draw, fill=none, minimum size=1em, 
                 outer sep=3pt, font=\tiny},
    EN/.style = {N, double, double distance=1.5pt},
every edge/.style = {draw, arr},
                    ]
% position the nodes a...d
\coordinate[label=left:I] (a);
\node (b) [N, right=of a] {$q_1$};
\node (c) [N, above right=of b] {$q_2$};
% position the nodes d...i
    \begin{scope}[nodes={on chain}]
\node (d) [N, below right=of c] {$q_3$};
\foreach \i in {e, f,...,h}
\node (\i) [N] {$q_\i$};
    \end{scope}
\node (ei) [EN, right=of h] {$q_i$};
\path   (a) edge                    (b)
(b) edge["$\varepsilon$"]   (c)
(c) edge["$\varepsilon$"]   (d)
(d) edge["0"]               (e)
(e) edge["$\varepsilon$"]   (f)
(f) edge["0"]               (g)
(g) edge["$\varepsilon$"]   (h)
(h) edge["1"]               (ei)
;
\draw[arr]  (ei) |- ([yshift=45mm] b.north west)
to ["$\varepsilon$" '] (b.north west);
%%%%
\node (j) [N, above right=of c] {$q_j$};
\node (k) [N, right=of j] {$q_k$};
\node (l) [N, right=of k] {$q_l$};
\node (m) [N, right=of l] {$q_m$};
\node (em) [EN, right=of l] {$q_m$};
\path   (c) edge["$\varepsilon$"]   (j)
        (j) edge["1"]               (k)
        (k) edge["$\varepsilon$"]   (l)
        (l) edge["0"]               (em);
\draw[arr]  (em) |- ([yshift=42mm] b.north)
                 to ["$\varepsilon$"] (b);
%%%%
    \begin{scope}[nodes={on chain}]
\node (n) [N, below right=of b] {$q$};
\foreach \i in {o, p,...,r}
\node (\i) [N] {$q_\i$};
    \end{scope}
\node (es) [EN, right=of r] {$q_s$};
\path   (b) edge["$\varepsilon$"]   (n)
        (n) edge["0"]               (o)
        (o) edge["$\varepsilon$"]   (p)
        (p) edge["1"]               (q)
        (q) edge["$\varepsilon$"]   (r)
        (r) edge["0"]               (es);
\draw[arr]  (es) |- ([yshift=-22mm] b.south)
                 to ["$\varepsilon$"] (b);
    \end{tikzpicture}
\end{center}
\end{document}

相关内容