\section{Colorisation Welsh} %<–––––––––––––––––––––––––– graphs with colors ––––––––––––––––––––––––––—––> Ce chapitre montre comment colorer des sommets. Le plus simple est d'utiliser le style \tkzname{Welsh} et la macro \tkzcname{AddVertexColor} afin de colorer les sommets. \subsection{La macro \tkzcname{AddVertexColor} } \begin{NewMacroBox}{AddVertexColor}{\var{color}\var{List of vertices}} \medskip \emph{Cette macro permet de colorer des sommets. Le premier argument est la couleur, le second une liste de sommets.} \end{NewMacroBox} \subsection{Exemple d'utilisation } \medskip Une compagnie aérienne propose des vols directs entre certaines villes, notées A, B, C, D, E, F et G. Cela conduit au graphe $\mathcal{G}$ suivant, dont les sommets sont les villes et les arêtes représentent les liaisons aériennes : \begin{center} \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{center} \begin{enumerate} \item Sur les cartes d'embarquement, la compagnie attribue à chaque aéroport une couleur, de sorte que deux aéroports liés par un vol direct aient des couleurs différentes. Proposer un coloriage adapté‚ cette condition. \item Que peut-on en déduire sur le nombre chromatique de $\mathcal{G}$ ? \end{enumerate} \begin{center} \begin{tkzltxexample}[] \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{tkzltxexample} \end{center} \bigskip \begin{minipage}{7cm} \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{minipage} \hfill \begin{minipage}{7cm} \begin{tabular}{cc} \hline \itshape Sommet & \itshape Degré \\ \hline B & $5$ \\ E & $5$ \\ C & $4$ \\ D & $4$ \\ A & $3$ \\ G & $3$ \\ F & $2$ \\ \hline \end{tabular} \end{minipage} \begin{tkzltxexample}[] \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{tkzltxexample} \bigskip \begin{minipage}{7cm} \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \SetVertexNoLabel \AddVertexColor{red}{B,F} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{minipage} \hfill \begin{minipage}{7cm} \begin{tabular}{ccc} \hline \itshape Sommet & \itshape Degré & \itshape Couleur\\ \hline B & $5$ & rouge\\ E & $5$ & \\ C & $4$ & \\ D & $4$ & \\ A & $3$ & \\ G & $3$ & \\ F & $2$ & rouge\\ \hline \end{tabular} \end{minipage} \begin{tkzltxexample}[] \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \SetVertexNoLabel \AddVertexColor{red}{B,F} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{tkzltxexample} \bigskip \begin{minipage}{7cm} \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \SetVertexNoLabel \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{minipage} \hfill \begin{minipage}{7cm} \begin{tabular}{ccc} \hline \itshape Sommet & \itshape Degré & \itshape Couleur\\ \hline B & $5$ & rouge\\ E & $5$ & bleu\\ C & $4$ & \\ D & $4$ & \\ A & $3$ & bleu\\ G & $3$ & \\ F & $2$ & rouge\\ \hline \end{tabular} \end{minipage} \begin{tkzltxexample}[] \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \SetVertexNoLabel \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{tkzltxexample} \bigskip \begin{minipage}{7cm} \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \SetVertexNoLabel \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A} \AddVertexColor{green}{C,G} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{minipage} \hfill \begin{minipage}{7cm} \begin{tabular}{ccc} \hline \itshape Sommet & \itshape Degré & \itshape Couleur\\ \hline B & $5$ & rouge\\ E & $5$ & bleu\\ C & $4$ & vert\\ D & $4$ & \\ A & $3$ & bleu\\ G & $3$ & vert\\ F & $2$ & rouge\\ \hline \end{tabular} \end{minipage} \begin{tkzltxexample}[] \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \SetVertexNoLabel \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A} \AddVertexColor{green}{C,G} \Vertex[Node]{D}} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{tkzltxexample} \bigskip \begin{minipage}{7cm} \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \SetVertexNoLabel \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A} \AddVertexColor{green}{C,G} \AddVertexColor{yellow}{D} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A) \Edges(B,E) \end{tikzpicture} \end{minipage} \hfill \begin{minipage}{7cm} \begin{tabular}{ccc} \hline \itshape Sommet & \itshape Degré & \itshape Couleur\\ \hline B & $5$ & rouge\\ E & $5$ & bleu\\ C & $4$ & vert\\ D & $4$ & jaune\\ A & $3$ & bleu\\ G & $3$ & vert\\ F & $2$ & rouge\\ \hline \end{tabular} \end{minipage} \begin{tkzltxexample}[] \begin{tikzpicture} \renewcommand*{\VertexLineWidth}{2pt} \GraphInit[vstyle=Welsh] \Vertices[unit=3]{circle}{A,B,C,D,E,F,G} \SetVertexNoLabel \AddVertexColor{red}{B,F} \AddVertexColor{blue}{E,A} \AddVertexColor{green}{C,G}\AddVertexColor{yellow}{D} \Vertex[Node]{D}} \Edges(G,E,F,G,B,D,E,C,D,A,C,B,A)\Edges(B,E) \end{tikzpicture} \end{tkzltxexample} \endinput