Sarmate.net Sarmate.net
Home Features Pricing Documentation Contact
Log in Sign up
Back to gallery
TikZ FR

Automate fini déterministe en TikZ — états, transitions, état acceptant

Sarmate sarmate_examples 2026-05-03 0 10

Diagramme d'un automate fini déterministe sur l'alphabet {a, b}, avec 4 états (q0 initial, q3 acceptant en double cercle vert), transitions étiquetées et boucles. Utilise la librairie automata de TikZ pour le rendu standard. Idéal pour cours d'informatique théorique, langages formels, compilation.

Open in demo Sign in to like
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows.meta}

\begin{document}
\begin{tikzpicture}[
  shorten >=1pt, node distance=2.6cm, on grid, auto, font=\sffamily,
  every state/.style={
    fill=blue!10, draw=blue!60!black, thick, minimum size=12mm
  },
  initial/.style={initial text=, initial by arrow},
  accepting/.style={fill=green!15, draw=green!50!black,
                    double, double distance=2pt}
]
  \node[state, initial]            (q0)                     {$q_0$};
  \node[state]                     (q1) [right=of q0]       {$q_1$};
  \node[state]                     (q2) [right=of q1]       {$q_2$};
  \node[state, accepting]          (q3) [right=of q2]       {$q_3$};

  \path[->, thick]
    (q0) edge              node {a} (q1)
    (q1) edge              node {b} (q2)
    (q2) edge              node {a} (q3)
    (q1) edge [bend left, blue!70!black]  node[above] {a} (q3)
    (q3) edge [loop above, red!70!black]  node {b} ()
    (q0) edge [loop above]                node {b} ()
    (q2) edge [bend right, below]         node {b} (q0);

  \node[above=4mm of q1.north, font=\footnotesize\itshape, anchor=south] {Automate fini déterministe sur $\{a, b\}$};

\end{tikzpicture}
\end{document}
This example is licensed under CC‑BY‑4.0. You may copy, modify, and redistribute it as long as you credit the author (Sarmate sarmate_examples).