# Latex: Changing nodes name using Tikz

Please, how do I change nodes name? I want to change my nodes from a,b,c,d,e to v1, v2, v3, v4 and v5 (please note that the numbers beside V must be subscript). Here is my latex Tikz

\documentclass[10pt]{amsart}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}

\begin{document}

\begin{figure}[!htb]
\centering
\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm,
thick,main node/.style={circle,draw,font=\sffamily\Large\bfseries}]

\node[main node] (a) {a};
\node[main node] (b) [below left of=a] {b};
\node[main node] (c) [below right of=a] {c};
\node[main node] (d)  [below of=b]{d};
\node[main node] (e)  [below of=c]{e};

\path
(a) [-]edge [loop above] node {} (a)
[-]edge node[below] {} (b)
[->]edge node [below]{} (c)
[->] edge node [right]{} (d)
[-] edge node [right]{} (e)

(b)    [-]edge [loop left] node {} (b)
[-]edge node[below] {} (a)
[->] edge node [right]{} (c)
[-] edge node [right]{} (d)

(c) [-]edge [loop right] node {} (c)

(d) [-]edge [loop below] node {} (d)
[->]edge node[below] {} (c)
[-]edge node[right] {} (b)

(e) [-]edge [loop below] node {} (e)
[-]edge node[below] {} (a)
[->]edge node[right] {} (b)
[->]edge node[below] {} (c)
[->] edge node [right]{} (d);
\end{tikzpicture}
\end{figure}

\end{document}


Thanks

• From an expression like node (a) {b}, a is the name which is used for reference and b is what is printed as node contents. There is no relation between one and the other, you can print whatever you want as contents: \node (a) {$v_1$}. – Ignasi Jul 15 '16 at 11:24

Just change \node[main node] (a) {a}; to \node[main node] (a) {$v_1$}; and so on.