2

I would like to use tkz-graph to layout cycles of vertices on concentric circles. If I had complete cycles then tkz-berge would do teh job nicely but because I wish to exclude some edges it seems to me that I need the former package. I would like to be able to achieve something like the subfigure on the left (first tikzpicture environment) by means of the tkz-graph's \Vertices* and \Edges macros. Here is a failing MWE, I believe.

\documentclass{standalone}


\usepackage{tikz}
\usepackage{tkz-berge}

\begin{document}
    \begin{tikzpicture}[scale=0.45,rotate=22.5]
      \GraphInit[vstyle=Simple]
      \tikzset{VertexStyle/.append style={minimum size=3pt}}
      \grCycle[RA=1.0,prefix=a,Math=true]{8}
      \grCycle[RA=2.5,prefix=b,Math=true]{8}
      \grCycle[RA=4.0,prefix=c,Math=true]{8}
      \grCycle[RA=5.5,prefix=d,Math=true]{8}
      \EdgeIdentity{a}{b}{8}
      \EdgeIdentity{b}{c}{8}
      \EdgeIdentity{c}{d}{8}
    \end{tikzpicture}

    \begin{tikzpicture}[scale=0.45,rotate=18]
      \GraphInit[vstyle=Simple]
      \tikzset{VertexStyle/.append style={minimum size=3pt}}
      \tikzset{node distance = 1.5cm}
      \Vertices{circle}{A,B,C,D,E}

      \begin{scope}
        \tikzset{VertexStyle/.append style={node distance = 3cm}}
%        \tikzstyle{every node} = [node distance = 3cm]
        \Vertices*{circle}{F,G,H,I,J}
      \end{scope}

      \begin{scope}
        \tikzset{VertexStyle/.append style={node distance = 4.5cm}}
%        \tikzstyle{every node} = [node distance = 3cm]
        \Vertices*{circle}{K,L,M,N,O}
      \end{scope}
    \end{tikzpicture}

\end{document}

enter image description here

From what I have read the answer might be for me to use \SetGraphUnit{1.5} but for other reasons I do not want to upgrade my texlive installation to the latest one. Is there a way I can layout vertices on concentric circles so that I can add only those edges I need?

  • I don't understand the link between the question and \SetGraphUnit? can you explain your idea ? – Alain Matthes Feb 21 '14 at 18:23
  • This was an idea that I had in desperation. – healyp Feb 25 '14 at 10:50
3

Perhaps I don't understand your question but you can use \grEmptyCycle if you want cycle without edges.

Then you can mix macros from tkz-berge and tkz-graph. I don't understand the link between the question and \SetGraphUnit? this macro modifies the unit used to define the distance between the vertices.

\documentclass{standalone}


\usepackage{tikz}
\usepackage{tkz-berge}

\begin{document}
    \begin{tikzpicture}[scale=0.45,rotate=22.5]
      \GraphInit[vstyle=Simple]
      \tikzset{VertexStyle/.append style={minimum size=3pt}}
      \grEmptyCycle[RA=1.0,prefix=a,Math=true]{8}
      \grEmptyCycle[RA=2.5,prefix=b,Math=true]{8}
      \grEmptyCycle[RA=4.0,prefix=c,Math=true]{8}
      \grEmptyCycle[RA=5.5,prefix=d,Math=true]{8}
    \end{tikzpicture}

\end{document}

enter image description here

Remarks : With tkz-berge there are some macros to draw sequences of edges like a0-a1-a2-a4 etc .. and you can exclude some edges.

It's possible to use a macro from tikz-graph. You can use the option circle with Vertice.

  • Thank you, this points me in the right direction. What I had not known was that it is possible to index individual vertices in the cycle. Now I can add edges as I want. Merci bien :-). – healyp Feb 25 '14 at 10:49
2

Just for typing exercise with PSTricks.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot,pgfmath}
\psset{plotpoints=9,showpoints}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
\foreach \c[count=\r from 1] in {A,...,D}{\curvepnodes{0}{360}{\r\space t PtoC}{\c}\psnline(0,8){\c}}
\foreach \i in {0,...,8}{\psline(A\i)(B\i)(C\i)(D\i)}
\end{pspicture}
\end{document}

enter image description here

  • 1
    Just for typing exercise with TiKZ not for PSTricks may be :). – texenthusiast Feb 21 '14 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.