![绘制有向图和 Tikz](https://linux22.com/image/316480/%E7%BB%98%E5%88%B6%E6%9C%89%E5%90%91%E5%9B%BE%E5%92%8C%20Tikz%20.png)
答案1
方法有很多,比如:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\foreach \a/\pos [count=\i] in {%
0/20,
-45/-25,
-90/-70,
-135/-115,
135/115} {
\draw[thick, -{Circle[open]}] (0, 0) -- (\a:20mm);
\node at (\pos:10mm) {$I_{\i}$};
}
\foreach \a/\direction in {0/<, -45/>, -90/<, -135/>, 135/<} {
\draw[thick, >={Stealth},-\direction] (0, 0) -- (\a:11mm);
}
\node[at=(current bounding box.south), below=2ex, inner sep=0pt]
{$I_1 - I_2 + I_3 - I_4 + I_5 = 0$};
\end{tikzpicture}
\end{document}
答案2
应该有一种直接的方法来绘制它,但你可以绘制两条路径:
\begin{tikzpicture}[thick]
\draw (0,0) -- (1,0);
\draw[<-] (1,0) node[above]{$I_1$} -- (2,0);
\end{tikzpicture}
否则,您可以使用 [midway] 选项,将节点写入路径中间。