Skip to content

The macro \EdgeDoubleMod

January 10, 2011
tags:

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

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).

Advertisements
2 Comments leave one →
  1. Skyler permalink
    January 15, 2011 5:45 pm

    Could you possibly include how to do non-simple graphs? In particular, I need graphs with loops in them. I know that I can do something like

    \Edge[style=loop](vertex)(vertex)

    and get a loop, but how would you change the orientation of it?

    • Rafael permalink*
      January 21, 2011 8:22 pm

      I’m not sure what you mean by the orientation of the loop, but I just made a new post that might help you with creating new styles of loops.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: