Skip to content

Options for vertices

October 17, 2011
tags:

This post is an update for this post from my old blog, which did not work with the newer versions of tkz-berge. The changes are:

  • instead of \tikzstyle{every node} = [node distance=1.5cm] one now has to use the macro: \SetGraphUnit{1.5},
  • the macro \Vertices needs now an extra argument: {line} (another useful option here is {circle})
  • the macro \Edges in line 16 needs the extra option local, in order for the other options (the color red) to work.
\begin{tikzpicture}
  \SetVertexNormal[LineColor=brown]
  \Vertex[x=0,y=2.5,style=orange,LabelOut=true,Lpos=90]{A}
  {\SetGraphUnit{1.5}
    \Vertices[x=1.5,y=4,dir=\SO,LabelOut=true,Ldist=5pt]{line}{B,C,D}}
  \Vertices[x=3,y=5,dir=\SO,style={shape=coordinate}]{line}{E,F,G,H,I,J}
  \Vertices[x=4.5,y=5,dir=\SO,style={font=\bfseries}]{line}{K,L,M,N,O,P}
  {\SetGraphUnit{1.5}
    \Vertices[x=6,y=4,dir=\SO,
    style={line width=2pt,
      inner sep=0pt,
      text=purple,
      fill=yellow,
      minimum size=12pt}]{line}{Q,R,S}}
  \Vertex[x=7.5,y=2.5,style={shape=rectangle,blue}]{T}
  \Edges[local,color=red,lw=2pt](A,B,E,K,Q,T,S,P,J,D,A)
  \Edges(B,G,L,R,T)
  \Edges(D,H,O,R)
  \Edges(A,C,F,M,Q)
  \Edges(C,I,N,S)
  \foreach \x/\y in {E/F,G/H,I/J,K/L,M/N,O/P}
  {\Edge(\x)(\y)}
  \Edge[style={bend left}](G)(N)
  \Edge[style={bend right}](A)(T)
\end{tikzpicture}

UPDATE For some reason I do not understand, the code above does not work with an updated installation of TeX Live 2011. (It worked for me with the TeX Live 2009 distributed in Ubuntu repositories). The following code produces the intended picture. Until it is figured out why the options to the \Vertex macro do not work well, it seems to be more predictable to use commands instead of options to the macro.

Such commands are defined starting at line 72 of tkz-graph.sty.

\begin{tikzpicture}
  \SetVertexNormal[LineColor=brown]
  {\renewcommand{\VertexLightFillColor}{orange}
    \Vertex[x=0,y=2.5,style=orange,LabelOut=true,Lpos=90]{A}}
  {\SetGraphUnit{1.5}
    \Vertices[x=1.5,y=4,dir=\SO,LabelOut=true,Ldist=5pt]{line}{B,C,D}}
  {\renewcommand{\VertexShape}{coordinate}
    \Vertices[x=3,y=5,dir=\SO]{line}{E,F,G,H,I,J}}
  \Vertices[x=4.5,y=5,dir=\SO,style={font=\bfseries}]{line}{K,L,M,N,O,P}
  {\SetGraphUnit{1.5}
    \renewcommand{\VertexLineWidth}{2pt}
    \renewcommand{\VertexInnerSep}{0pt}
    \renewcommand{\VertexTextColor}{purple}
    \renewcommand{\VertexLightFillColor}{yellow}
    \renewcommand{\VertexInterMinSize}{12pt}
    \Vertices[x=6,y=4,dir=\SO]{line}{Q,R,S}}
  {\renewcommand{\VertexShape}{rectangle}
    \renewcommand{\VertexLightFillColor}{blue}
    \Vertex[x=7.5,y=2.5]{T}}
  \Edges[local,color=red,lw=2pt](A,B,E,K,Q,T,S,P,J,D,A)
  \Edges(B,G,L,R,T)
  \Edges(D,H,O,R)
  \Edges(A,C,F,M,Q)
  \Edges(C,I,N,S)
  \foreach \x/\y in {E/F,G/H,I/J,K/L,M/N,O/P}
  {\Edge(\x)(\y)}
  \Edge[style={bend left}](G)(N)
  \Edge[style={bend right}](A)(T)
\end{tikzpicture}

Vertices

Advertisements
4 Comments leave one →
  1. John permalink
    May 4, 2012 4:46 am

    I’m using the latest version of tkz-berge and tkz-graph (June 2011) from CTAN, but the vertex styles don’t seem to be working for me. The keyword “style” is recognised by the compiler, but it only seems to affect the vertex labels rather than the vertices themselves. (So the label for A is coloured orange, but A itself is the same style as B, as are G, Q and T.) I’ve tried with both pgf 2.1 and pgf 2.0, with the same result for each. Do you have any idea what might be causing this?

    • May 4, 2012 7:40 am

      I see what you mean, and I think the change comes from outside tkz-berge and tkz-graph. I’ll check during the weekend!

      • May 7, 2012 2:43 pm

        I have updated the post, hope it is useful.

      • John permalink
        May 7, 2012 2:46 pm

        Yes, that seems to work – thanks!

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: