1

I drew the following graph with tkz-berge, but only want vertices "v" and "u" to show up, how can I do this?

I've tried with \AssignVertexLabel but I seem to lack understanding of how to use it.

\documentclass[border=5mm,tikz]{standalone}    
\usepackage{tikz}
\usepackage{tkz-berge}
\begin{document}
     \begin{tikzpicture}[scale=1]
        \GraphInit[vstyle=Classic]
%       \SetVertexNoLabel
        \SetUpVertex[FillColor=black, MinSize=8pt]
        \SetGraphUnit{2}
            \begin{scope}[rotate=0]
                \Vertices{circle}{u,b,v,d,e,f}
            \end{scope}
%       \AssignVertexLabel{u}{u}
%       \AssignVertexLabel{v}{v}
        \SetUpEdge[lw=1.5pt, color=black]
            \Edges(u,b,v,d,e,f,u)
        \SetUpEdge[lw=1.5pt, color=gray!70]
            \Edges(v,f,d)
            \Edges(d,b,e)
     \end{tikzpicture}
\end{document}

enter image description here

1

You can temporarily disable the automatic labeling with \SetVertexNoLabel before drawing the vertices, then activate it again with \SetVertexLabel after, and then use \Vertex[Node]{u} etc.

The Node option is necessary to indicate that u and v are referring to the already defined references u and v created with \Vertices.

MWE:

\documentclass[border=2mm]{standalone}
\usepackage{tkz-berge}

\begin{document}
\begin{tikzpicture}[scale=1]
  \GraphInit[vstyle=Classic]
  \SetVertexNoLabel % <--- ADDED
  \SetUpVertex[FillColor=black, MinSize=8pt]
  \SetGraphUnit{2}
  \Vertices{circle}{u,b,v,d,e,f}
  \SetVertexLabel % <--- ADDED
  \Vertex[Node]{u} % <--- ADDDED
  \Vertex[Node,Lpos=120]{v} % <--- ADDED
  \SetUpEdge[lw=1.5pt, color=black]
    \Edges(u,b,v,d,e,f,u)
  \SetUpEdge[lw=1.5pt, color=gray!70]
    \Edges(v,f,d)
    \Edges(d,b,e)
\end{tikzpicture}
\end{document}

Output

  • I didn't know you could just write \Vertices{circle}{u,b,v,d,e,f} :D Thank you for your help! :) – Sam Apr 18 '16 at 19:35

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.