如何在一條邊上寫label。
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=.5]
\tikzstyle{state}=[filled vertex]
\node[state] (a) at (1,1.7) {};
\node[state] (b) at (0,0) {};
\draw[thick,violet] (a)--(b);
\node at (0.26,1) {$x$};
\end{tikzpicture}
\caption{How to write a label on an edge. }
\label{fig:st-component}
\end{figure}