我有以下代码来获取一个包含两个节点 $v_1$ 和 $v_2$ 以及 $v_1$ 和 $v_2$ 之间的边的图。
\tikzstyle{place}=[circle,minimum size=1mm,
inner sep=0pt, outer sep=0pt,fill=black,thick]
\begin{tikzpicture}[shorten >=1pt,node distance=3cm,auto]
\node[place,label=above:$v_1$] (v1) at (0,0) {};
\node[place,label=above:$v_2$] (v2) at (1,0) {};
\draw [-] (v1) -- (v2);
\end{tikzpicture}
答案1
\documentclass[tikz, border=1cm]{standalone}
\tikzset{
place/.style={circle, minimum size=1mm,
inner sep=0pt, outer sep=0pt, fill
}}
\begin{document}
\begin{tikzpicture}
\node[place, label=above:$v_1$] (v1) at (0,0) {};
\node[place, label=above:$v_2$] (v2) at (1,0) {};
\draw (v1) -- (v2);
\end{tikzpicture}
\end{document}