Skip to content

The macro \EdgeDoubleMod

January 10, 2011

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:

  \tikzset{VertexStyle/.append style=
    {inner sep=0pt,font=\footnotesize\sffamily}}
  {\tikzset{EdgeStyle/.append style = {blue,line width=3pt}}
  {\tikzset{EdgeStyle/.append style = {green,line width=2pt}}

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

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


    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: Logo

You are commenting using your 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: