\documentclass[a4paper,10pt]{article}

%Packages Ecriture
\usepackage[latin1]{inputenc} %Caractères accentués
\usepackage[french]{babel} %Traduction française
\usepackage[T1]{fontenc} %Codage des caractères
\usepackage{lmodern} %Polices vectorielles

%Packages Mise en page
\usepackage[margin=2cm]{geometry}
\usepackage{fancyhdr} %gestion des ET et PDP

%Packages mathématiques
\usepackage{amsmath} %Equations
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{pifont}

%Packages Tableaux
\usepackage{tabularx} %Tableaux
\usepackage{multirow} %Gestion des lignes
\usepackage{multicol} %Gestion des colones
\usepackage{arydshln} %Lignes en pointillés
\usepackage{fancybox} %Boites
\usepackage{multicol} %Colonnes
\usepackage{array} %Tableaux maths
\usepackage{fancybox}

%Packages Figures et graphiques
\usepackage{graphics} %inclusion de figures
\usepackage{graphicx} %inclusion de figures
\usepackage{pstricks,pst-node} %Graphiques
\usepackage{tikz} %Tikz !

%En-tête et pieds de page
\pagestyle{fancy} 
\fancyhf{}
\lhead{}
\rhead{}
\chead{\LARGE{\textsc{Graphes en LaTeX}}}
\lfoot{http://mathematiques.daval.free.fr}
\rfoot{}
\cfoot{}

%Tableaux
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1cm}}
\renewcommand{\arraystretch}{1.5}

\newcommand{\pt}[4]{\dotnode(#2,#3){#1} \uput[#4](#2,#3){#1}}
\newcommand{\ptt}[4]{\dotnode(#2,#3){#1} \uput[#4](#2,#3){{\tiny #1}}}
\usetikzlibrary{arrows} 


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

%%%%%%%%%%%%%%%%%%%%
\section{Graphe simple}

\begin{pspicture}(-2,-0.75)(2.5,1.5)
   \psset{dotsize=0.2,labelsep=0.25,unit=0.6}
      \pt{A}{0}{0}{dl}
      \pt{B}{3}{0}{dr}
      \pt{C}{3}{2}{ur}
      \pt{D}{0}{2}{ul}
      \pt{E}{1}{3}{u}
      \pt{F}{1}{-1}{dr}
      \psline(D)(A)(B)(C)(D)(E)(C)
      \psline(A)(F)(B)
\end{pspicture}   
\begin{pspicture}(-2,0)(2.3,3)
   \psset{xunit=1.5,yunit=0.7,dotsize=0.2,labelsep=0.25}
      \pt{A}{0}{3}{l}
      \pt{B}{1.2}{4}{u}
      \pt{C}{1.8}{2}{r}
      \pt{D}{1.2}{0}{d}
      \pt{E}{0}{1}{l}
      \psline(E)(A)(B)(C)(D)(B)(E)
      \psline(D)(A)(C)(E)(D)
\end{pspicture}


%%%%%%%%%%%%%%%%%%%%     
\section{Graphe orienté}

\begin{pspicture}(-2.5,-0.5)(13,2.5)
\psset{dotsize=0.2,labelsep=0.2,arrowsize=0.2,unit=0.9}
   \dotnode(0,2){A} \uput[u](0,2){PLBC | -}
   \dotnode(3,2){B} \uput[u](3,2){PLB | C}
   \dotnode(6,2){C} \uput[u](6,2){PLC | B}
   \dotnode(9,2){D} \uput[u](9,2){PBC | L}
   \dotnode(12,2){E} \uput[u](12,2){PL | BC}   
   \dotnode(0,0){F} \uput[d](0,0){BC | PL}
   \dotnode(3,0){G} \uput[d](3,0){L | PBC}
   \dotnode(6,0){H} \uput[d](6,0){B | PLC}
   \dotnode(9,0){I} \uput[d](9,0){C | PLB}
   \dotnode(12,0){J} \uput[d](12,0){- | PLBC}      
   \psline{->}(A)(F)
   \psline{->}(F)(D)
   \psline{->}(D)(H)
   \psline{->}(H)(B)
   \psline{->}(B)(G)
   \psline{->}(G)(E)
   \psline{->}(E)(J)
   \psline[linestyle=dashed](D)(I)(C)(G)
\end{pspicture} 


%%%%%%%%%%%%%%%%%%%%    
\section{Graphe coloré}

\begin{pspicture}(-2,-0.5)(3,2)
   \psset{dotsize=0.4,dotstyle=o,labelsep=0.35,unit=0.7,fillstyle=solid}
      \psset{fillcolor=blue}
      \pt{A}{0}{0}{dl}
      \psset{fillcolor=yellow}
      \pt{B}{2}{0}{dr}
      \psset{fillcolor=green}
      \pt{C}{2}{2}{ur}
      \psset{fillcolor=red}
      \pt{D}{0}{2}{ul}
      \ncline{A}{B}
      \ncline{B}{C}
      \ncline{C}{D}
      \ncline{D}{A} 
      \ncline{C}{A}
      \ncline{D}{B}     
\end{pspicture}
\begin{pspicture}(-1.5,-0.5)(3,2)
   \psset{dotsize=0.4,dotstyle=o,labelsep=0.35,unit=0.7,fillstyle=solid}
   \psset{fillcolor=blue}
      \pt{A}{0}{0}{dl}
      \pt{C}{2}{2}{ur}
   \psset{fillcolor=yellow}
      \pt{B}{2}{0}{dr}      
      \pt{D}{0}{2}{ul}
   \psset{fillcolor=red}
      \pt{E}{1}{1}{d}
      \ncline{A}{B}
      \ncline{B}{C}
      \ncline{C}{D}
      \ncline{D}{A} 
      \ncline{C}{E}
      \ncline{D}{E}    
      \ncline{A}{E}
      \ncline{B}{E}        
\end{pspicture}
 \begin{pspicture}(-1.5,-0.5)(4,2)
   \psset{dotsize=0.4,dotstyle=o,labelsep=0.35,unit=0.7,fillstyle=solid}
   \psset{fillcolor=blue}
      \pt{A}{0}{0}{dl}
      \psset{fillcolor=yellow}
      \pt{B}{4}{0}{dr}
   \psset{fillcolor=green}
      \pt{C}{2}{3}{u}
   \psset{fillcolor=red}
      \pt{D}{2}{1}{d}
      \ncline{A}{B}
      \ncline{B}{C}
      \ncline{C}{A}
      \ncline{D}{A}    
      \ncline{D}{B}
      \ncline{D}{C} 
\end{pspicture}


%%%%%%%%%%%%%%%%%%%%    
\section{Graphe pondéré}

\begin{pspicture}(-1.5,-0.8)(3,1.8)
   \psset{dotsize=0.25,labelsep=0.1,unit=0.7,shortput=nab,unit=0.8}
         \pt{$s_1$}{0}{0}{dl}
         \pt{$s_2$}{5}{0}{dr}
         \pt{$s_3$}{3}{3}{u}
         \pt{$s_4$}{0}{2}{ul}
         \ncline[linecolor=blue]{$s_1$}{$s_4$}^{\textcolor{blue}{$a_1$}}
         \ncline[linecolor=blue]{$s_3$}{$s_1$}^{\textcolor{blue}{$a_2$}}
         \ncline[linecolor=blue]{$s_3$}{$s_2$}^{\textcolor{blue}{$a_3$}}
         \ncarc[arcangle=30,linecolor=blue]{$s_1$}{$s_2$}^{\textcolor{blue}{$a_4$}}
         \ncarc[arcangle=30,linecolor=blue]{$s_2$}{$s_1$}^{\textcolor{blue}{$a_5$}}
         \nccircle[linecolor=blue]{$s_3$}{.5cm}^{\textcolor{blue}{$a_6$}}
\end{pspicture}     
\begin{pspicture}(-3,-0.8)(6,2.5)
   \psset{unit=0.7,dotsize=0.2,labelsep=0.2,shortput=nab}
      \dotnode(0,3){M} \uput[ul](0,3){M($28_\text{C}$)}
      \dotnode(0,0){H} \uput[dl](0,0){H($22_\text{C}$)}
      \dotnode(3,3){C} \uput[u](3,3){C($14_\text{A}$)}
      \dotnode(3,0){U} \uput[d](3,0){U($12_\text{R}$)}
      \dotnode(6,3){A} \uput[ur](6,3){A($9_\text{R}$)}      
      \dotnode(6,0){R} \uput[dr](6,0){R($0$)}      
      \ncline{M}{C}^{\textcolor{blue}{\scriptsize{14}}}
      \ncline{H}{M}^{\textcolor{blue}{\scriptsize{7}}}
      \ncline{U}{H}^{\textcolor{blue}{\scriptsize{11}}}
      \ncline{H}{C}^{\textcolor{blue}{\scriptsize{8}}}
      \ncline{U}{C}^{\textcolor{blue}{\scriptsize{9}}}
      \ncline{C}{A}^{\textcolor{blue}{\scriptsize{5}}}
      \ncline{U}{A}^{\textcolor{blue}{\scriptsize{7}}}
      \ncline{R}{U}^{\textcolor{blue}{\scriptsize{12}}}
      \ncline{A}{R}^{\textcolor{blue}{\scriptsize{9}}}
   \end{pspicture} 

\begin{multicols}{2}
%%%%%%%%%%%%%%%%%%%%        
 \section{Graphe probabiliste}

\begin{pspicture}(-2,-2)(3,3.5)
   \psset{dotsize=0.2,labelsep=0.05,nodesep=0.1,unit=0.6,shortput=nab,arrows=->,arrowsize=0.3}
      \dotnode(0,0){p} \uput[d](0.4,-0.6){pluie}
      \dotnode(5,0){s} \uput[r](5.3,0){soleil}
      \dotnode(2.5,4){n} \uput[r](3,4){neige}
      \ncarc[arcangle=20]{p}{s}^{\textcolor{blue}{{\footnotesize $0,25$}}}
      \ncarc[arcangle=20]{s}{p}^{\textcolor{blue}{{\footnotesize $0,5$}}}
      \ncarc[arcangle=20]{p}{n}^{\textcolor{blue}{{\footnotesize $0,25$}}}
      \ncarc[arcangle=-20,arrows=<-]{p}{n}^{\textcolor{blue}{{\footnotesize $0,25$}}}
      \nccircle{n}{.5cm}^{\textcolor{blue}{{\footnotesize $0,5$}}}
      \nccircle[angle=90]{p}{.5cm}^{\textcolor{blue}{{\footnotesize $0,5$}}}
      \ncarc[arcangle=20]{n}{s}^{\textcolor{blue}{{\footnotesize $0,25$}}}
      \ncarc[arcangle=20]{s}{n}^{\textcolor{blue}{{\footnotesize $0,5$}}}
   \end{pspicture} 
   
%%%%%%%%%%%%%%%%%%%%  
\section{Automate}

\qquad \begin{psmatrix}
   &  & [mnode=circle] 5 \\
   &  & [mnode=circle,doubleline=true] 4 \\
   {\white 0} & [mnode=circle] 1 &  & [mnode=circle] 3 \\
   &  & [mnode=circle] 2
\end{psmatrix}
\psset{arrows=->,shortput=nab,arrowsize=0.15}
   \nccircle[angleA=0]{3,2}{0.5cm}\nbput{$b$}
   \ncline{2,3}{3,2}^{$b$}
   \ncarc[arcangle=15]{3,2}{4,3}^{$a$}
   \ncarc[arcangle=15]{4,3}{3,2}^{$b$}
   \ncline{3,4}{3,2}\nbput{$b$}
   \ncline{2,3}{1,3}^{$a$}
   \ncline{3,4}{2,3}^{$a$}
   \ncline{4,3}{3,4}^{$a$}
   \nccircle[angleA=90]{1,3}{0.5cm}\nbput{$b$}
   \nccircle[angleA=-90]{1,3}{0.5cm}\nbput{$a$}
   \psset{doubleline=true}
   \ncline{3,1}{3,2}^{départ}
   
   


\end{multicols}

\end{document}