Finally, the much expected new versions (1.00 c) of tzk-graph and tkz-berge were released by Alain Matthes last week, and can be downloaded from Altermundus download zone.

I expect to post several examples using the new capabilities of the packages. For the time being, I will only say that:

• \grCycle (and \grEmptyCycle) has an optional argument rotation that, well, rotates the cycle by the given degrees, hence eliminating the need to use the scope environment.
• The commands like \SetUpVertex and \SetVertexNormal accept also several optional arguments, so that one can avoid setting styles with \tikzset.
• All of the commands that draw Edges (except \EdgeDoubleMod, that has already nine arguments) can accept optional arguments, changing the look and/or style of the edge.

For example, the line graph of the Petersen graph can be drawn now as:

\begin{tikzpicture}
\SetUpVertex[Style={font=\footnotesize\sffamily}]
\SetVertexNormal[MinSize=12pt,InnerSep=0pt]
\grCirculant[RA=0.6,prefix=a,rotation=-90]{5}{2}
\grEmptyCycle[RA=1.5,prefix=b,rotation=-18]{5}{2}
\grCycle[RA=2.5,prefix=c,rotation=18]{5}
\EdgeIdentity[local,color=red]{a}{b}{5}
\EdgeIdentity[local,lw=0.5pt]{b}{c}{5}
{\tikzset{EdgeStyle/.append style = {blue,line width=3pt}}
\EdgeDoubleMod{b}{5}{0}{1}{a}{5}{2}{1}{5}}
{\tikzset{EdgeStyle/.append style = {green,line width=2pt}}
\EdgeDoubleMod{c}{5}{0}{1}{b}{5}{1}{1}{5}}
\end{tikzpicture}


The vertices that tkz-berge draws are regular named TikZ nodes, and so they can be used if one wants unusual edges.

Update: I added four more lines, to show that one can also use the node names provided by tkz-berge, to apply extra labels.

\begin{tikzpicture}
\usetikzlibrary{decorations.pathmorphing,arrows}
\tikzset{EdgeStyle/.append style = {line width=2pt}}
\grEmptyPath[RA=2]{6}
\draw[line width=3pt] (a0) .. controls (-1,1) and (1,1) .. (a0);
\draw[thick,color=blue] (a1) .. controls (0,0) and (2,2) .. (a1);
\draw (a2) .. controls (0,2) and (8,2) .. (a2);
\shadedraw[top color=brown,opacity=0.8] (a3) circle (0.7cm);
\draw[thick,decorate,decoration=snake] (a4) -- (a5);
\draw (a2) node[below]{\textsf{a label}};
\draw (a3) node[above right=5pt]{$v_{0}$};
\node (mytext) at (9,1.5) [shape=rectangle,align=center,draw] {a good\\ vertex};
\draw[->,line width=1pt] (mytext)  -- (a4);
\end{tikzpicture}
tags:

The macro \EdgeDoubleMod is convenient when drawing some complicated graphs. Consider the following picture of the line graph of the Petersen graph.

produced by:

\begin{tikzpicture}
\SetVertexNormal[MinSize=12pt]
\tikzset{VertexStyle/.append style=
{inner sep=0pt,font=\footnotesize\sffamily}}
\begin{scope}[rotate=-90]
\grCirculant[RA=0.6,prefix=a]{5}{2}
\end{scope}
\begin{scope}[rotate=-18]
\grEmptyCycle[RA=1.5,prefix=b]{5}{2}
\end{scope}
\begin{scope}[rotate=18]
\grCycle[RA=2.5,prefix=c]{5}
\end{scope}
\EdgeIdentity{a}{b}{5}
\EdgeIdentity{b}{c}{5}
{\tikzset{EdgeStyle/.append style = {blue,line width=3pt}}
\EdgeDoubleMod{b}{5}{0}{1}{a}{5}{2}{1}{5}}
{\tikzset{EdgeStyle/.append style = {green,line width=2pt}}
\EdgeDoubleMod{c}{5}{0}{1}{b}{5}{1}{1}{5}}
\end{tikzpicture}



We construct the graph using tree cycles: a circulant, an “empty” cycle and a usual cycle. The code \EdgeIdentity{a}{b}{5} just joins, for each $i$ from 0 to 4 (that is, five times) the vertex labeled $a_i$ to the vertex labeled $b_i$.

Finally \EdgeDoubleMod{b}{5}{0}{1}{a}{5}{2}{1}{5} joins, for each $i$ between 0 and 4 (that is the 5 in the last argument), the vertex labeled $b_{0+1\cdot i}$ to the vertex labeled $a_{2+1\cdot i}$. In both cases, the sub-index is calculated mod 5 (because of the second and the sixth argument).

Also with captions.

\GraphInit[vstyle=Hasse]
\begin{tikzpicture}
\pgfmathsetmacro{\theshift}{4/(1+sin(30))-2}
\begin{scope}[yshift=-\theshift cm]
\grTetrahedral[RA=4/(1+sin(30))]
\end{scope}
\draw (0,-2.5) node [fill=magenta!30!white,below]{$K_{4}$};
\pgfmathsetmacro{\theshift}{4/(1+sin(54))-2}
\begin{scope}[xshift=6cm,yshift=-\theshift cm,rotate=90]
\grComplete[RA=4/(1+sin(54))]{5}
\end{scope}
\draw (6,-2.5) node [fill=magenta!30!white,below]{$K_{5}$};
\begin{scope}[xshift=12cm]
\grComplete[RA=2/sin(60)]{6}
\end{scope}
\draw (12,-2.5) node [fill=magenta!30!white,below]{$K_{6}$};
\end{tikzpicture}


tags: ,

Note that we have to adjust the radius of the third graph so that it aligns with the other two.

\GraphInit[vstyle=Hasse]
\begin{tikzpicture}
\grLCF[RA=2]{5}{10}
\begin{scope}[xshift=5cm]
\grLCF[RA=2]{3,-3}{5}
\end{scope}
\pgfmathsetmacro{\theshift}{2*cos(18)-(4*cos(18)/(1+cos(36)))}
\begin{scope}[xshift=10cm,yshift=\theshift cm,rotate=90]
\grPrism[RA=1,RB=(4*cos(18)/(1+cos(36)))]{5}
\end{scope}
\end{tikzpicture}



This macro is useful for circulants. Observe:

\begin{tikzpicture}
\grCycle[prefix=a,RA=3]{14}
\EdgeInGraphMod{a}{8}{3}
\end{tikzpicture}


which produces:

This means that the edges ai – ai+3 are added to the graph, starting when i=0 and whenever i+3<8. The “3” here is the third argument of the macro, and the “8” is the second. The “a” is the identifier of the vertices joined by the added edges.

Hence the circulant is obtained by:

\begin{tikzpicture}
\grCycle[RA=3]{14}
\EdgeInGraphMod{a}{14}{3}
\end{tikzpicture}


that is:

A flower snark (${J_{5}}$).

\begin{tikzpicture}
\SetUpEdge[color=blue,lw=2pt]
\begin{scope}[rotate=90]
\grCycle[prefix=a,RA=1]{5}
\grEmptyCycle[prefix=b,RA=3]{5}
\end{scope}
\begin{scope}[rotate=90+24]
\grEmptyCycle[prefix=c,RA=3]{5}
\end{scope}
\begin{scope}[rotate=90-24]
\grEmptyCycle[prefix=d,RA=3]{5}
\end{scope}
\SetUpEdge[color=red,lw=2pt]
\EdgeIdentity{a}{b}{5}
\EdgeIdentity{b}{c}{5}
\EdgeIdentity{b}{d}{5}
\EdgeMod{c}{d}{5}{1}
\EdgeMod{c}{d}{5}{4}
\end{tikzpicture}