1

I'm creating a graph with tkz berge, but I want my own labels, not the ones given by the empty ladder sequence. Is there any way to overwrite the tkz berge labels a_0, a_1, etc. and give my own?

Here's my code:

\documentclass[dvipsnames]{article}
\usepackage{tikz}
\usepackage{tkz-berge}
\begin{document}
\begin{tikzpicture}
\begin{scope}[rotate=90]
\tikzset{VertexStyle/.style ={shape = circle,
shading = ball,
ball color = RoyalPurple!60,
%
minimum size = 24pt,
%
draw}}
\SetVertexMath
   \grEmptyLadder[RA=2,RB=4]{3}   
   \EdgeFromOneToSel{a}{b}{1}{0}
   \EdgeFromOneToSel{a}{b}{0}{1}
   \EdgeFromOneToSel{a}{b}{1}{1}
   \EdgeFromOneToSel[label={$1,2$}]{a}{b}{1}{2}
   \EdgeFromOneToSel[label={$1,3$}]{a}{b}{2}{1}
   \EdgeFromOneToSel[label={$2,2$}]{a}{b}{2}{2}
   \end{scope}
\end{tikzpicture}
\end{document} 

enter image description here

egreg
  • 1,121,712
Laura
  • 13
  • 3
  • 3
    Welcome to TeX.SE. It would be helpful if you took the code in the linked question and added your own text to yield a fully compilable MWE including \documentclass{} (\begin{document} and \end{document}) and the appropriate packages that illustrates the problem . While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem, instead of spending time to first reproduce the problem. – skpblack Oct 13 '14 at 16:27
  • You can change the prefix letters used using the prefix and prefixx keys, but it will still add the subscripts for you. Is that what you want? – Thruston Oct 13 '14 at 18:05

1 Answers1

0

EDIT

Sorry, what I wrote below is wrong. I just learnt from tikz-code-for-drawing-an-icosahedron-and-labeling that tikz-graph provides a way of doing this: simply use

\SetVertexNoLabel
\grEmptyLadder[RA=2,RB=4]{3}
\AssignVertexLabel{a}{$A$,$B$,$C$}
\AssignVertexLabel{b}{$D$,$E$,$F$}

I will vote to close this as a duplicate.

Old post

If you want control over the individual vertex labels, and not just be changing the prefix as Thurston suggests using something like

\grEmptyLadder[RA=2,RB=4,prefix=X]{3} 

then I think that you need to place the vertices "by hand" and use the L=<label> option. For example, you can create the graph:

enter image description here

using the code:

\documentclass[dvipsnames]{article}
\usepackage{tikz}
\usepackage{tkz-berge}
\begin{document}
\begin{tikzpicture}[%
  VertexStyle/.style={shape=circle, shading=ball, ball color=RoyalPurple!60,
                      minimum size=24pt, draw}]
  \Vertex[L=$A$]{a0}          % place a vertex labelled A
  \NO[unit=2,L=$B$](a0){a1}   % place B north of A=a0
  \NO[unit=2,L=$C$](a1){a2}   % place C north of B=a1
  \WE[unit=4,L=$D$](a0){b0}   % place D west of A=a0
  \NO[unit=2,L=$E$](b0){b1}   % place E north of D=b0
  \NO[unit=2,L=$F$](b1){b2}   % place F north of E=b1
  \EdgeFromOneToSel{a}{b}{1}{0}
  \EdgeFromOneToSel{a}{b}{0}{1}
  \EdgeFromOneToSel{a}{b}{1}{1}
  \EdgeFromOneToSel[label={$1,2$}]{a}{b}{1}{2}
  \EdgeFromOneToSel[label={$1,3$}]{a}{b}{2}{1}
  \EdgeFromOneToSel[label={$2,2$}]{a}{b}{2}{2}
\end{tikzpicture}
\end{document}

Note that if you want to use \EdgeFromOneToSel then you need to label the vertices as a0,a1,a2,b0,b1,b2 as this is what this command expects.