4

Problem Description

I am trying to created a labeled digraph using the tkz-graph package, such that the vertices are "automatically" labeled $v_1$, $v_2$, etc., starting with $v_1$ at the "top" of the circle and then clockwise.

MWE:

\documentclass{article}
\usepackage{tkz-graph}
\begin{document}
    \begin{tikzpicture}[rotate=90]
        \GraphInit[vstyle=Hasse]
        \tikzset{VertexStyle/.style={
        shape=circle,
        inner sep = 2pt,
        outer sep = 1pt,
        minimum size = 7pt,
        draw}
        }
        \Vertices[unit=2]{circle}{v1,v2,v3,v4,v5,v6,v7}
        \tikzstyle{EdgeStyle}=[post]
        \Edges(v1,v4,v3)
        \Edges(v4,v5,v6)
        \Edge(v7)(v1)
        \Edge(v2)(v1)
        \Edge(v2)(v3)
    \end{tikzpicture}
\end{document}

How do I add the required labels?

1

1 Answer 1

6

The easiest would be to change the vstyle to Classic since this would add labels automatically. Because you rotate the graph, you need to set the option Lpos=90.

Finally, you can use the option Math to allow for simple mathematical expressions to name the vertices. So, you can directly name them v_1, v_2 and so on.

I think you want to label the vertices counterclockwise since this is also how they are defined in the graph:

\documentclass{article}
\usepackage{tkz-graph}
\begin{document}
    \begin{tikzpicture}[rotate=90]
        \GraphInit[vstyle=Classic]
        \tikzset{VertexStyle/.style={
                shape = circle,
                inner sep = 2pt,
                outer sep = 1pt,
                minimum size = 7pt,
                draw
            },
            EdgeStyle/.style={
                post
            }
        }
        \Vertices[unit=2, Lpos=90, Math] {circle}
            {v_1,v_2,v_3,v_4,v_5,v_6,v_7}
        \Edges(v_1,v_4,v_3)
        \Edges(v_4,v_5,v_6)
        \Edge(v_7)(v_1)
        \Edge(v_2)(v_1)
        \Edge(v_2)(v_3)
    \end{tikzpicture}
\end{document}

enter image description here

1
  • 1
    I actually wanted them labeled counterclockwise. Nonetheless, this answers my question. Thanks!
    – DJJerome
    Commented Aug 16, 2022 at 20:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .