tkz-berge

Purpose

The package tkz-berge.sty is a collection of some useful macros if you want to draw some classic graphs of the graph theory or to make others graphs.

News

15/02/2011. This is a beta version v 1.00 c (c for CTAN) of tkz-berge. Before uploading this package on the CTAN servers, I need to adapt it, some optimizations are possible with PGF 2.1 . The beta version works with pgf 2.1. tkz-berge loads tkz-arith.sty but this package calls an important file tkz-tools-arith.tex. I need some specific arithmetic tools to build tkz-berge, and some of them appear slowly inside the code of pgf. It's the main reason why I need to update the code. Send me an email, if you get an error.

How to install

You need to install pgf 2.1 , tkz-graph, tkz-berge and tkz-tools-arith.tex. The last file can be found inside tkz-base. If you don't have install tkz-base and tkz-euclide than you get download tkz-tools-arith.tex here :

tkz-tools-arith.tex

Why tkz-berge.sty ?

Claude Berge (1926 – 2002) was a French mathematician, recognized as one of the modern founders of combinatorics and graph theory. He played a major role in the renaissance of combinatorics and he is remembered for his famous conjecture on perfect graphs, solved some months after his death.

The names of graphs can be found here MathWorld by E.Weisstein

Some links about graphs

You can find the following graphs in this document : NamedGraphs.pdf

From this document

Complete bipartite graph

The complete bipartite graph illustrated below plays an important role in the novel Foucault's Pendulum by Umberto Eco.

Screenshot (click image to enlarge)
Exemple0.
[PDF] [TEX]
% Complete bipartite graph : $K_{18,18}$ 
% Author : Alain Matthes
% Encoding : UTF8
% Engine : PDFLaTeX
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-berge,fullpage}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 
\thispagestyle{empty}
\begin{document}
\begin{center}
  \begin{tikzpicture}[rotate=90,scale=1.4]
    \GraphInit[vstyle=Art]
    \grCompleteBipartite[RA=0.5,RB=0.5,RS=9]{18}{18}
   \end{tikzpicture}
\end{center}
\end{document}

Exemple 1 : Heawood graph

Screenshot (click image to enlarge)
Exemple1.
[PDF] [TEX]
% Heawood graph
% Author : Alain Matthes
% Encoding : UTF8
% Engine : PDFLaTeX
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-berge,fullpage}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 
\thispagestyle{empty}
\begin{document}
\begin{center}
\begin{tikzpicture}
   \tikzset{VertexStyle/.style= {shape        = circle,
                                  shading      = ball,
                                  ball color   = Blue!60,
                                  minimum size = 24pt,
                                  draw}}
   \SetVertexNoLabel
   \tikzset{EdgeStyle/.style= {thick,
                                double          = orange,
                                double distance = 1pt}}
   \grHeawood[RA=6]
\end{tikzpicture}
\end{center}
\end{document}

Exemple 2 : Circulant graph

Screenshot (click image to enlarge)
Exemple1.
[PDF] [TEX]
% Circulant graph
% Author : Alain Matthes
% Encoding : UTF8
% Engine : PDFLaTeX
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-berge,fullpage}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 
\thispagestyle{empty}   
\begin{document}
\begin{center}
\begin{tikzpicture}
\GraphInit[vstyle=Shade]
\grCirculant[Math,RA=6]{12}{5}
\end{tikzpicture}
\end{center}
\end{document}

Exemple 3 : Complete graph

Screenshot (click image to enlarge)
Exemple3.
[PDF] [TEX]
% Complete graph
% Author : Alain Matthes
% Encoding : UTF8
% Engine : PDFLaTeX
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-berge,fullpage}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 
\thispagestyle{empty} 
\begin{document}
\begin{center}
\begin{tikzpicture}
  \renewcommand*{\VertexBallColor}{green!50!black}
  \GraphInit[vstyle=Art]
  \grComplete[RA=6]{16}
\end{tikzpicture}
\end{center}
\end{document}

Exemple 4 : Dodecahedral

Screenshot (click image to enlarge)
Exemple4.
[PDF] [TEX]
% Dodecahedral graph
% Author : Alain Matthes
% Encoding : UTF8
% Engine : PDFLaTeX
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-berge,fullpage}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 
\thispagestyle{empty} 
\begin{document}
\begin{center}
\begin{tikzpicture}
  \SetVertexNoLabel
  \GraphInit[vstyle=Shade]
  \SetGraphShadeColor{green!60!black!30}{Brown}{white}
  \grDodecahedral[RA=7,RB=4.5]
\end{tikzpicture}
\end{center}
\end{document}

Exemple 5 Möbius-Kantor

In this example, I use an external file tableae.dat
Screenshot (click image to enlarge)
Exemple5.
[PDF] [TEX]
% MobiusKantor graph
% Author : Alain Matthes
% Encoding : UTF8
% Engine : PDFLaTeX
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-berge,fullpage}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 
\thispagestyle{empty}  
\begin{document}
\begin{center}
\begin{tikzpicture}
   \tikzset{VertexStyle/.style=   { shape        = circle,
                                    shading      = ball,
                                    ball color   = green!40!black,
                                    minimum size = 24pt,
                                    draw}}
   \SetVertexNoLabel
   \tikzset{EdgeStyle/.style=   {thick,
                                 double          = orange,
                                 double distance = 1pt}}
   \grMobiusKantor[RA=5]
\end{tikzpicture}
\end{center}
\end{document}

Exemple 6 Petersen generalized graph

Screenshot (click image to enlarge)
Exemple6.
[PDF] [TEX]
% Generalized Petersen graph
% Author : Alain Matthes
% Encoding : UTF8
% Engine : PDFLaTeX
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-berge,fullpage}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 
\thispagestyle{empty} 
\begin{document}
\begin{center}
\begin{tikzpicture}[rotate=90]
\tikzset{VertexStyle/.style = {shape           = circle,
                               shading         = ball,
                               ball color      = green!60!black,
                               minimum size    = 24pt,
                               draw}}
\tikzset{EdgeStyle/.style = {thick,%
                             double           = orange,
                             double distance  = 1pt}} 
\SetVertexNoLabel
\grGeneralizedPetersen[Math,RA=5,RB=2]{5}{2}
\end{tikzpicture}
\end{center}
\end{document}

Exemple 7 Groetzsch graph

Screenshot (click image to enlarge)
Exemple7
[PDF] [TEX]
% Groetzsch graph
% Author : Alain Matthes
% Encoding : UTF8
% Engine : PDFLaTeX
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-berge,fullpage}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon} 
\thispagestyle{empty}  
\begin{document}
\tikzset{VertexStyle/.style = {shape           = circle,
                                shading         = ball,
                                ball color      = blue!60,
                                inner sep       = 6pt,
                                draw}}
\SetVertexNoLabel
\tikzset{EdgeStyle/.style = {thick,double    = red,
                              double distance = 1pt}} 
\begin{tikzpicture}[rotate=-18]
 \draw[scale=.5,samples at={-6.4,-6.3,...,6.4},
       smooth,thick,
       variable=\t,
       double= red,
       double distance = 1pt]
       plot ({3*(1.5*cos(\t r) +3*cos(1.5*\t r))},
             {3*(1.5*sin(\t r) -3*sin(1.5*\t r))});
\begin{scope}[rotate=36]
   \grStar[prefix=a,RA=2.2]{6}
   \grEmptyCycle[prefix=b,RA=4.4]{5}
\end{scope}
\end{tikzpicture}
\end{document}