I'm trying to add a pseudocode to my article using latex and the algorithm2e package.
Unfortunatly i'm getting a bad format for one of my algorithms.
Here is my latex file :
\documentclass[12pt,a4paper,oneside]
\usepackage{url}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{amssymb,amsmath,amsthm}
%\\usepackage{graphics}
\usepackage{graphicx}
\usepackage[linesnumbered,french]{algorithm2e}
\usepackage{hyperref}
\usepackage{cite}
\usepackage{float}
\begin{document}
\begingroup
\fontsize{10pt}{12pt}\selectfont
\begin{algorithm}[H]
\Entree{Un Graphe G, Ensemble de Sommets X}
\Sortie{Liste de sommets: ensemble dominant minimum}
\caption{Algorithme pour tout type de graphe}
\Si{$taille(X) = 0$}{\State \Retour\{\}}
\State Choisir v tel que $d(v) =1$ ou $2$\\
\Si {v est vide}{
\State X0 = sommets dans X avec degré 0\\
\Si {taille$(X0)$ = taille$(X)$}{
\State \Retour X0
}
\State X1 = X - X0\\
\State X2 = ensemble des sous-ensembles de X1 de taille $1$ à $3 *$ taille$(X1)/8$\\
\State \Retour {l'ensemble de X2 qui est MDS de X1}
}
\Si{$d(v) = 1$}{
\Si {v \in V - X}
{\State \Retour mdsForArbitraryGraph $(G-\{v\}, X-\{v\})$}
\SinonSi {$v \in X$}
{\State choisir w tel que w et le voisin unique de v\\
\State \Retour mdsForArbitraryGraph$(G-\{v, w\}, X-N[w])$}
}
\SinonSi {$d(v) = 2$}{
\State {u1, u2 = voisins de v}\\
\Si {v \in V-X}{
\State C1 = mdsForArbitraryGraph $(G-\{u1, v\}, X-N[u1])$\\
\State C2 = mdsForArbitraryGraph $(G-\{u1, v, u2\}, X-\{u1, u2\})$\\
\State C3 = mdsForArbitraryGraph $(G-\{v\}, X)$\\
\State \Retour min (C1, C2, C3)
}
\SinonSi {v \in X}{
\State D1 = mdsForArbitraryGraph $(G-\{u1, v\}, X-N [u1])$\\
\State D2 = mdsForArbitraryGraph $(G-\{u1, v, u2\}, X-\{u1, v, u2\})$\\
\State D3 = mdsForArbitraryGraph $(G-\{u2, v\}, X-N[u2])$\\
\State \Retour min (D1, D2, D3)\\
}
}
\end{algorithm}
\endgroup
\end{document}
and here the bad output:
could anyone check why i'm getting this bad format.
as we can see the end of the pseudocode is not complete with the end statement(fin in french).
Thank you