Wednesday, August 02, 2006

Heawood graph

The smallest cubic graph of girth 6, or 6-cage, drawn with PS Tricks. This was inspired from the example in The LaTeX Graphics Companion, page 121.

\documentclass{article}
\usepackage{pstricks,pst-node,multido,ifthen,calc}
\pagestyle{empty}

\begin{document}
\begin{center}
\begin{pspicture}(-1,-1.5)(1,1.5)
\psset{unit=1.5cm}
\newcounter{CtA}
\newcounter{Temp}
\newcounter{Tempi}
\SpecialCoor \degrees[14]
\multido{\ia=0+1}{14}{%
\setcounter{CtA}{\ia}%
\addtocounter{CtA}{1}%
\multido{\ib=\value{CtA}+1}{1}{\psline{o-o}(1;\ia)(1;\ib)}
}%
\multido{\ia=0+2}{7}{%
\setcounter{CtA}{\ia}%
\addtocounter{CtA}{5}
\multido{\ib=\value{CtA}+1}{1}{\psline{o-o}(1;\ia)(1;\ib)}
}%
\multido{\i=1+1}{14}{\rput(1;\i){%
\setcounter{Temp}{\i}%
\ifthenelse{\isodd{\value{Temp}}}%
{\setcounter{Tempi}{(\value{Temp}+1)/2}}
{\setcounter{Tempi}{(\value{Temp})/2}}
}%
}
\end{pspicture}
\end{center}
\end{document}


No comments: