Les graphes

Dans le préambule on met :

\usepackage{tkz-graph}

Sommets sans nom

Pour obtenir :

On tape :

\begin{document}
\begin{tikzpicture}[scale=1]
\GraphInit[vstyle=Simple]
\Vertex{A}
\Vertex[x=4,y=0]{B}
\Vertex[x=1,y=2]{C}
\Vertex[x=3,y=1.5]{D}
\Edge[style={bend left}](B)(A)
\Edge[style={bend right}](D)(A)
\Edge[style={bend left}](C)(D)
\Edge[style={bend left}](D)(B)
\Edges(B,C,A)
\end{tikzpicture}
\begin{tikzpicture}
\SetGraphUnit{2}
\GraphInit[vstyle=Simple]
\Vertices{circle}{A,B,C,D,E}
\Edge(A)(C)
\Edge(C)(E)
\Edge(E)(B)
\Edge(B)(D)
\Edge(D)(A)
\end{tikzpicture}
\hspace{1cm}
\begin{tikzpicture}
\SetGraphUnit{2}
\GraphInit[vstyle=Simple]
\Vertices{circle}{A,B,C,D,E}
\Edge(A)(B)
\Edge(A)(C)
\Edge(A)(D)
\Edge(A)(E)
\Edge(B)(E)
\Edge(C)(E)
\Edge(D)(E)
\end{tikzpicture}\\
\vspace{0.5cm}\\
\begin{tikzpicture}[scale=1]
\GraphInit[vstyle=Simple]
\Vertex{A}
\Vertex[x=4,y=0]{B}
\Vertex[x=4,y=3]{C}
\Vertex[x=0,y=3]{D}
\Edges(A,B,C,D,A)
\Edge(B)(D)
\end{tikzpicture}\hspace{0.5cm}
\begin{tikzpicture}[scale=1]
\GraphInit[vstyle=Simple]
\Vertex{A}
\Vertex[x=5,y=0]{B}
\Vertex[x=5,y=3]{C}
\Vertex[x=0,y=3]{D}
\Vertex[x=2.5,y=1.5]{E}
\Edges(A,B,C,D,A)
\Edge(A)(E)
\Edge(B)(E)
\Edge(C)(E)
\Edge(D)(E)
\end{tikzpicture}\\

Les sommets ont un nom

Pour obtenir :

On tape :

\begin{document}
\begin{tikzpicture}[scale=1]
\GraphInit[vstyle=Normal]
\Vertex{A}
\Vertex[x=4,y=0]{B}
\Vertex[x=1,y=2]{C}
\Vertex[x=3,y=1.5]{D}
\Vertex[x=2.5,y=-2]{E}
\Edge[style={bend right}](A)(E)
\Edge[style={bend right}](A)(B)
\Edge[style={bend right}](E)(B)
\Edge[style={bend left}](A)(D)
\Edge[style={bend left}](C)(D)
\end{tikzpicture}
\begin{tikzpicture}[scale=1]
\GraphInit[vstyle=Normal]
\Vertex{1}
\Vertex[x=4,y=0]{2}
\Edge[style={bend left}](2)(1)
\Edge[style={bend right}](2)(1)
\Loop[dist=2cm,style={thick,-}](1)
\end{tikzpicture}
\begin{tikzpicture}
\SetGraphUnit{2}
\GraphInit[vstyle=Normal]
\Vertices{circle}{A,B,C,D,E}
\Edge[style={bend left}](B)(A)
\Edge[style={bend right}](C)(A)
\Edge[style={bend right}](B)(C)
\Edge[style={bend left}](B)(D)
\Edge[style={bend left}](B)(E)
\Edge[style={bend left}](C)(D)
\Edge[style={bend left}](D)(E)
\end{tikzpicture}

Les arêtes sont orientées


On tape :

\begin{tikzpicture}[scale=1]
\GraphInit[vstyle=Normal]
\Vertex{1}
\Vertex[x=4,y=0]{2}
\Vertex[x=1,y=2]{3}
\Vertex[x=3,y=1.5]{4}
\Vertex[x=2.5,y=-2]{5}
\Edge[style={bend right,thick,->}](1)(5)
\Edge[style={bend right,thick,->}](1)(2)
\Edge[style={bend right,thick,->}](2)(1)
\Edge[style={bend right,thick,->}](5)(2)
\Edge[style={bend left,thick,->}](1)(4)
\Edge[style={bend left,thick,->}](3)(4)
\end{tikzpicture}
\begin{tikzpicture}[scale=1]
\GraphInit[vstyle=Normal]
\Vertex{1}
\Vertex[x=4,y=0]{2}
\Edge[style={bend left,thick,->}](2)(1)
\Edge[style={bend left,thick,->}](1)(2)
\Loop[dist=2cm,style={thick,->}](1)
\end{tikzpicture}

Avec des poids


On tape :

\begin{tikzpicture}[scale=1]
\GraphInit[vstyle=Normal]
\Vertex{A}
\Vertex[x=2,y=1.5]{B}
\Vertex[x=2,y=-1.5]{C}
\Vertex[x=4,y=0]{D}
\Vertex[x=6,y=1.5]{E}
\Vertex[x=6,y=-1.5]{F}
\Vertex[x=8,y=0]{G}
\Edge[label=$4$](A)(B)
\Edge[label=$2$](A)(C)
\Edge[label=$3$](B)(D)
\Edge[label=$5$](C)(D)
\Edge[label=$5$](B)(E)
\Edge[label=$3$](C)(F)
\Edge[label=$1$](D)(E)
\Edge[label=$4$](D)(F)
\Edge[label=$5$](D)(G)
\Edge[label=$8$](F)(G)
\Edge[label=$4$](E)(G)
\end{tikzpicture}
\begin{tikzpicture}[scale=1]
\GraphInit[vstyle=Normal]
\Vertex{A}
\Vertex[x=4,y=0]{B}
\Edge[style={bend right,thick,->},label={0,3}](A)(B)
\Edge[style={bend right,thick,->},label={0,8}](B)(A)
\Loop[dist=2cm,style={thick,->},label={0,7} ](A)
\Loop[dist=2cm,dir=EA,style={thick,->},label={0,2} ](B)
\end{tikzpicture}\\