\newcommand{\point}[4]{ \node [label=#3:#4] (#1) at #2 {}; } \newcommand{\wpath}[3]{ \draw (#1) -- (#2) node [midway, above, sloped] (Tx#1#2) {{\tiny $#3$}}; } \begin{tikzpicture}[] \begin{scope}[every node/.style={fill=black, shape=circle, inner sep=1pt}] \point{1}{(0,1)}{left}{$v_1$} \point{2}{(1,2)}{above}{$v_2$} \point{3}{(1,0)}{below}{$v_3$} \point{4}{(3,2)}{above left}{$v_4$} \point{5}{(3,0)}{below right}{$v_5$} \point{6}{(5,2)}{above left}{$v_6$} \point{7}{(5,0)}{above left}{$v_7$} \point{8}{(6,1)}{above right}{$v_8$} \end{scope} \wpath{1}{3}{1} \wpath{2}{3}{2} \wpath{7}{8}{2} \wpath{3}{5}{3} \wpath{4}{5}{4} \wpath{6}{8}{5} \wpath{5}{6}{6} \end{tikzpicture}