I can add some explanations and other solutions.
Firstly, tkz-graph is a tool for drawing graphs at school and generally one edge has one label but I can understand that sometimes it's necessary to use two labels. Secondly, i use xkeyval for the keys and options and I have some difficulties to make something substantial; you can find some inconsistency in the syntax. In the next version, I will use pgfkeys and I think I will get a better code.
Actually, easiest way with all my packages, is to use TikZ when you get a problem here a solution is to add : (like Gonzalo's code)
\path (s)-- node [right]{$a$}(a);
The best way
Sorry I forget my personal code :(
When you draw an edge, style
is used to draw the edge but labelstyle
is to add extra options for the labels
With \Edge[label={$\{g_1\}$}, labelstyle={left,label=right:$a$}](s)(a)
you put the main label with label=
and you can add another label inside the labelstyle ! (I forgot this possibility !!
\documentclass{article}
\usepackage{tkz-graph}
\begin{document}
\begin{figure}[b]
\centering
\begin{tikzpicture}
\SetUpEdge[lw = 1pt,
color = black,
labelcolor = white]
\SetVertexNoLabel
\GraphInit[vstyle=Normal]
\SetGraphUnit{3}
\tikzset{VertexStyle/.append style={fill}}
\Vertex{s}
\NO(s){a} \EA(a){b} \SO(b){c}
\Edge[label={$\{g_1\}$}, labelstyle={left,label=right:$a$}](s)(a)
\Edge[label={$\{g_1\}$}, labelstyle={above}](a)(b)
\Edge[label={$\{g_1\}$}, labelstyle={right}](b)(c)
\end{tikzpicture}
\end{figure}
% or with a circle
\begin{tikzpicture}[rotate=-45]% needs another rotation here -45
\SetVertexNoLabel
\SetGraphUnit{3}
\GraphInit[vstyle=Normal]
\Vertices{circle}{c,b,a,s}
\Edge[label={left:$\{g_1\}$}, labelstyle={left,label=right:$a$,label=60:$b$}](s)(a)
\Edge[label={$\{g_1\}$}, labelstyle={above}](a)(b)
\Edge[label={$\{g_1\}$}, labelstyle={right}](b)(c)
\end{tikzpicture}
\end{document}
You can add several labels with for example:
\Edge[label={left:$\{g_1\}$}, labelstyle={left,label=right:$a$,label=60:$b$}](s)(a)
More complex is the use of LabelStyle
like this
\documentclass{article}
\usepackage{tkz-graph}
\begin{document}
\begin{figure}[b]
\centering
\begin{tikzpicture}
\SetUpEdge[lw = 1pt,
color = black,
labelcolor = white]
\SetVertexNoLabel
\GraphInit[vstyle=Normal]
\SetGraphUnit{3}
\tikzset{VertexStyle/.append style={fill}}
\Vertex{s}
\NO(s){a} \EA(a){b} \SO(b){c}
{\tikzset{LabelStyle/.style={label=right:$a$}}%
\Edge[label={$\{g_1\}$}, labelstyle={left}](s)(a) }
%\path (s)-- node [right]{$a$}(a);
\Edge[label={$\{g_1\}$}, labelstyle={above}](a)(b)
\Edge[label={$\{g_1\}$}, labelstyle={right}](b)(c)
\end{tikzpicture}
\end{figure}
\end{document}
You can see that I need to use a scope (TeX's group to limit the action of the style.
The result is always :
Another way to draw your graph
you can use \Vertices
with the option square
, this macro can place vertices on a line, a triangle, a square and a circle directly.
\documentclass{article}
\usepackage{tkz-graph}
\begin{document}
\begin{tikzpicture}[rotate=45]
\SetVertexNoLabel
\SetGraphUnit{3}
\GraphInit[vstyle=Normal]
\Vertices{square}{c,b,a,s}
\Edge[label={left:$\{g_1\}$}, labelstyle={left,label=right:$a$,label=60:$b$}](s)(a)
\Edge[label={$\{g_1\}$}, labelstyle={above}](a)(b)
\Edge[label={$\{g_1\}$}, labelstyle={right}](b)(c)
\end{tikzpicture}
Conclusion
1) Remember that tkz-graph uses TikZ and you can use the commands of TikZ.
2) Rmember that you can modify each style locally with a TeX's group