1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
%
% adjazenz.tex
%
% (c) 2019 Prof Dr Andreas Müller, Hochschule Rapperswil
%
\bgroup
\definecolor{darkred}{rgb}{0.5,0,0}
\begin{frame}[fragile]
\newboolean{pfeilspitzen}
\setboolean{pfeilspitzen}{true}
\frametitle{Adjazenz-Matrix}
\begin{columns}[t]
\begin{column}{0.48\hsize}
\begin{center}
\begin{tikzpicture}[>=latex]
\def\r{2.2}
\coordinate (A) at ({\r*cos(-54+0*72)},{\r*sin(-54+0*72)});
\coordinate (C) at ({\r*cos(-54+1*72)},{\r*sin(-54+1*72)});
\coordinate (D) at ({\r*cos(-54+2*72)},{\r*sin(-54+2*72)});
\coordinate (B) at ({\r*cos(-54+3*72)},{\r*sin(-54+3*72)});
\coordinate (E) at ({\r*cos(-54+4*72)},{\r*sin(-54+4*72)});
\def\knoten#1#2{
\fill[color=white] #1 circle[radius=0.3];
\draw[line width=1pt] #1 circle[radius=0.3];
\node at #1 {$#2$};
}
\def\kante#1#2#3{
\ifthenelse{\boolean{pfeilspitzen}}{
\draw[->,line width=1pt,shorten >= 0.3cm,shorten <= 0.3cm]
#1 -- #2;
}{
\draw[line width=1pt,shorten >= 0.3cm,shorten <= 0.3cm]
#1 -- #2;
}
% \fill[color=white,opacity=0.7] ($0.5*#1+0.5*#2$) circle[radius=0.22];
% \node at ($0.5*#1+0.5*#2$) {$#3$};
}
\kante{(A)}{(E)}{1}
\kante{(B)}{(C)}{2}
\kante{(B)}{(D)}{13}
\kante{(C)}{(A)}{3}
\kante{(D)}{(C)}{6}
\kante{(E)}{(B)}{5}
\kante{(E)}{(D)}{6}
\knoten{(A)}{1}
\knoten{(B)}{2}
\knoten{(C)}{3}
\knoten{(D)}{4}
\knoten{(E)}{5}
\end{tikzpicture}
\end{center}
\end{column}
\begin{column}{0.48\hsize}
\[
a_{{\color{darkred}i}{\color{blue}j}}
=
\begin{cases}
1&\quad\text{\# Kanten von ${\color{blue}j}$ nach ${\color{darkred}i}$}\\
0&\quad\text{sonst}
\end{cases}
\]
\begin{center}
\begin{tikzpicture}[>=latex]
\node at (0,0) {$\displaystyle
A=
\begin{pmatrix}
0&0&1&0&0\\
0&0&0&0&1\\
0&1&0&1&0\\
0&1&0&0&1\\
1&0&0&0&0
\end{pmatrix}
$};
\def\s{0.54}
\foreach \x in {1,...,5}{
\node[color=blue] at ({-0.71+(\x-1)*\s},1.4) {\tiny $\x$};
}
\node[color=blue] at ({-0.71+2*\s},1.7) {von};
\def\r{0.48}
\foreach \y in {1,...,5}{
\node[color=darkred] at ({-0.71+5*\s},{0.02+(3-\y)*\r}) {\tiny $\y$};
}
\node[color=darkred] at ({-0.4+5*\s},{0.02}) [rotate=90] {nach};
\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}
\egroup
|