67 lines
2.3 KiB
TeX
67 lines
2.3 KiB
TeX
|
\begin{mgraphbox}[width=\linewidth]
|
||
|
\begin{figure}[H]
|
||
|
\begin{center}
|
||
|
\begin{tikzpicture}
|
||
|
|
||
|
\begin{scope}[every node/.style={shape=circle, fill=white, draw, inner sep=2pt}]
|
||
|
\node (A) at (0,4.0) {$A$};
|
||
|
\node (B) at (-2.82843,2.82843) {$B$};
|
||
|
\node (C) at (-4.0,0.0) {$C$};
|
||
|
\node (D) at (-2.82843,-2.82843) {$D$};
|
||
|
\node (E) at (-0.0,-4.0) {$E$};
|
||
|
\node (F) at (2.82843,-2.82843) {$F$};
|
||
|
\node (G) at (4.0,-0.0) {$G$};
|
||
|
\node (H) at (2.82843,2.82843) {$H$};
|
||
|
\end{scope}
|
||
|
|
||
|
\begin{scope}[every draw/.style={}]
|
||
|
\draw (A) -- (B) node [midway, above, sloped] (TxAB) {1};
|
||
|
\draw (A) -- (C) node [midway, above, sloped] (TxAC) {2};
|
||
|
\draw (A) -- (H) node [midway, above, sloped] (TxAH) {11};
|
||
|
\draw (B) -- (C) node [midway, above, sloped] (TxBC) {7};
|
||
|
\draw (B) -- (F) node [midway, above, sloped] (TxBF) {12};
|
||
|
\draw (C) -- (D) node [midway, above, sloped] (TxCD) {3};
|
||
|
\draw (C) -- (H) node [midway, above, sloped] (TxCH) {14};
|
||
|
\draw (D) -- (E) node [midway, above, sloped] (TxDE) {9};
|
||
|
\draw (D) -- (F) node [midway, above, sloped] (TxDF) {6};
|
||
|
\draw (D) -- (G) node [midway, above, sloped] (TxDG) {10};
|
||
|
\draw (F) -- (G) node [midway, above, sloped] (TxFG) {8};
|
||
|
\end{scope}
|
||
|
|
||
|
\end{tikzpicture}
|
||
|
\end{center}
|
||
|
\end{figure}
|
||
|
\end{mgraphbox}
|
||
|
|
||
|
Minimal spanning tree:
|
||
|
|
||
|
\begin{mgraphbox}[width=\linewidth]
|
||
|
\begin{figure}[H]
|
||
|
\begin{center}
|
||
|
\begin{tikzpicture}
|
||
|
|
||
|
\begin{scope}[every node/.style={shape=circle, fill=white, draw, inner sep=2pt}]
|
||
|
\node (A) at (0,4.0) {$A$};
|
||
|
\node (B) at (-2.82843,2.82843) {$B$};
|
||
|
\node (C) at (-4.0,0.0) {$C$};
|
||
|
\node (D) at (-2.82843,-2.82843) {$D$};
|
||
|
\node (E) at (-0.0,-4.0) {$E$};
|
||
|
\node (F) at (2.82843,-2.82843) {$F$};
|
||
|
\node (G) at (4.0,-0.0) {$G$};
|
||
|
\node (H) at (2.82843,2.82843) {$H$};
|
||
|
\end{scope}
|
||
|
|
||
|
\begin{scope}[every draw/.style={}]
|
||
|
\draw (A) -- (B) node [midway, above, sloped] (TxAB) {1};
|
||
|
\draw (A) -- (C) node [midway, above, sloped] (TxAC) {2};
|
||
|
\draw (A) -- (H) node [midway, above, sloped] (TxAH) {11};
|
||
|
\draw (C) -- (D) node [midway, above, sloped] (TxCD) {3};
|
||
|
\draw (D) -- (E) node [midway, above, sloped] (TxDE) {9};
|
||
|
\draw (D) -- (F) node [midway, above, sloped] (TxDF) {6};
|
||
|
\draw (F) -- (G) node [midway, above, sloped] (TxFG) {8};
|
||
|
\end{scope}
|
||
|
|
||
|
\end{tikzpicture}
|
||
|
\end{center}
|
||
|
\end{figure}
|
||
|
\end{mgraphbox}
|