我是 Latex 的新手。实际上,我正在使用预定义模板为我的高级算法课程制作图表。
这是我在正方形内绘制图形的代码。
\begin{figure}
\begin{tikzpicture}[scale=1.8, auto,swap]
% Draw a 7,11 network
% First we draw the vertices
\foreach \pos/\name in {{(3,2)/a}, {(2,1)/c}, {(3,1)/b},
{(4,1)/d},{(5,1)/e},{(1,0)/f},{(2,0)/g},{(6,0)/h}}
\node[vertex] (\name) at \pos {$\name$};
% Connect vertices with edges and draw weights
\foreach \source/ \dest /\weight/\pos in {c/a,
d/a,
b/a,
e/a,a/c,c/f,c/g,e/h}
\path[edge] (\source) -- (\dest);
\draw (0,-0.3) -- (6.4,-0.3) -- (6.4,1.8) -- (0,1.8) -- (0,-0.3);
\end{tikzpicture}
\end{figure}
\end{frame}