Skip to content

Commit f0ebe4e

Browse files
committed
Add Graph Theory Intro chapter
1 parent 3059826 commit f0ebe4e

18 files changed

+922
-34
lines changed

tex/GraphTheoryIntro.tex

Lines changed: 663 additions & 0 deletions
Large diffs are not rendered by default.

tex/Introduction.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
%Все главы, начиная с~\ref{chpt:GraphTheoryIntro}, снабжены списком вопросов и задач для самостоятельного решения и закрепления материала.
4949

5050
\begin{figure*}
51+
\caption{Структура данной книги}
5152
\begin{center}
5253
\begin{tikzpicture}[shorten >= 1pt,
5354
auto,
@@ -83,5 +84,4 @@
8384
(q_flpq) edge (q_mcfpq);
8485
\end{tikzpicture}
8586
\end{center}
86-
\caption{Структура данной книги}
8787
\end{figure*}

tex/LinearAlgebra.tex

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,15 @@ \section{Группа}
216216
\begin{example}
217217
Рассмотрим несколько примеров групп.
218218
\begin{itemize}
219-
\item Целые числа $\Z$ с операцией сложения $+$ являются группой.
219+
\item Целые числа $\BbbZ$ с операцией сложения $+$ являются группой.
220220
Получается дополнением моноида из предыдущего раздела обратными по сложению элементами.
221-
\item Целые числа $\Z$ без нуля%
221+
\item Целые числа $\BbbZ$ без нуля%
222222
\sidenote{
223223
При наличии нуля возникают трудности с нейтральным элементом.
224224
Логично считать $1$ нейтральным по умножению, однако $0 \cdot 1 = 0$, а не 1, как того требует определение.}
225225
с операцией умножения $\cdot$ не являются группой, так как нет обратных по умножению.
226-
Действительно, возьмём $a = 3$, тогда должен существовать $a^{-1} \in \Z$, такой что $3 \cdot a^{-1} = 1$.
227-
Видим, что $a^{-1} = 1/3$, но $1/3 \notin \Z$.
226+
Действительно, возьмём $a = 3$, тогда должен существовать $a^{-1} \in \BbbZ$, такой что $3 \cdot a^{-1} = 1$.
227+
Видим, что $a^{-1} = 1/3$, но $1/3 \notin \BbbZ$.
228228
\item Множество обратимых%
229229
\sidenote{
230230
Квадратная матрица $M$ называется обратимой, если существует матрица $N$, называемая обратной, такая что $M \cdot N = N \cdot M = I$, где $I$~--- единичная матрица.
@@ -238,25 +238,25 @@ \section{Полукольцо}
238238
\begin{definition}[Полукольцо]
239239
Непустое множество $R$ с двумя бинарными операциями $\oplus: R \times R \to R$ (часто называют сложением) и $\otimes: R \times R \to R$ (часто называют умножением) называется \emph{полукольцом}, если выполнены следующие условия.
240240
\begin{enumerate}
241-
\item $(R, \oplus)$~--- это коммутативный моноид, нейтральный элемент которого~--- $\bz$. Для любых $a, b, c \in R$:
241+
\item $(R, \oplus)$~--- это коммутативный моноид, нейтральный элемент которого~--- $\Bbbzero$. Для любых $a, b, c \in R$:
242242
\begin{itemize}
243243
\item $(a \oplus b) \oplus c = a \oplus (b \oplus c)$
244-
\item $\bz \oplus a = a \oplus \bz = a$
244+
\item $\Bbbzero \oplus a = a \oplus \Bbbzero = a$
245245
\item $a \oplus b = b \oplus a$
246246
\end{itemize}
247-
\item $(R, \otimes)$~--- это моноид, нейтральный элемент которого~--- $\bo$. Для любых $a, b, c \in R$:
247+
\item $(R, \otimes)$~--- это моноид, нейтральный элемент которого~--- $\Bbbzero$. Для любых $a, b, c \in R$:
248248
\begin{itemize}
249249
\item $(a \otimes b) \otimes c = a \otimes (b \otimes c)$
250-
\item $\bo \otimes a = a \otimes \bo = a$
250+
\item $\Bbbzero \otimes a = a \otimes \Bbbzero = a$
251251
\end{itemize}
252252
\item $\otimes$ дистрибутивно слева и справа относительно $\oplus$:
253253
\begin{itemize}
254254
\item $a \otimes (b \oplus c) = (a \otimes b) \oplus (a \otimes c)$
255255
\item $(a \oplus b) \otimes c = (a \otimes c) \oplus (b \otimes c)$
256256
\end{itemize}
257-
\item $\bz$ является \emph{аннигилятором} по умножению:
257+
\item $\Bbbzero$ является \emph{аннигилятором} по умножению:
258258
\begin{itemize}
259-
\item для любых $a \in R$ выполнено $\bz \otimes a = a \otimes \bz = \bz$
259+
\item для любых $a \in R$ выполнено $\Bbbzero \otimes a = a \otimes \Bbbzero = \Bbbzero$
260260
\end{itemize}
261261
\end{enumerate}
262262
Если операция $\otimes$ коммутативна, то говорят о \emph{коммутативном полукольце}.
@@ -321,20 +321,20 @@ \section{Кольцо}
321321
\begin{definition}[Кольцо]
322322
Непустое множество $R$ с двумя бинарными операциями $\oplus: R \times R \to R$ (умножение) и $\otimes: R \times R \to R$ (сложение) называется \emph{кольцом}, если выполнены следующие условия.
323323
\begin{enumerate}
324-
\item $(R, \oplus)$~--- это абелева группа, нейтральный элемент которой~--- $\bz$.
324+
\item $(R, \oplus)$~--- это абелева группа, нейтральный элемент которой~--- $\Bbbzero$.
325325
Для любых $a, b, c \in R$:
326326
\begin{itemize}
327327
\item $(a \oplus b) \oplus c = a \oplus (b \oplus c)$
328-
\item $\bz \oplus a = a \oplus \bz = a$
328+
\item $\Bbbzero \oplus a = a \oplus \Bbbzero = a$
329329
\item $a \oplus b = b \oplus a$
330-
\item для любого $a \in R$ существует $-a \in R$, такой что $a + (-a) = \bz$.
330+
\item для любого $a \in R$ существует $-a \in R$, такой что $a + (-a) = \Bbbzero$.
331331
\end{itemize}
332332
В последнем пункте кроется отличие от полукольца.
333-
\item $(R, \otimes)$~--- это моноид, нейтральный элемент которого~--- $\bo$.
333+
\item $(R, \otimes)$~--- это моноид, нейтральный элемент которого~--- $\Bbbzero$.
334334
Для любых $a, b, c \in R$:
335335
\begin{itemize}
336336
\item $(a \otimes b) \otimes c = a \otimes (b \otimes c)$
337-
\item $\bo \otimes a = a \otimes \bo = a$
337+
\item $\Bbbzero \otimes a = a \otimes \Bbbzero = a$
338338
\end{itemize}
339339
\item $\otimes$ дистрибутивно слева и справа относительно $\oplus$:
340340
\begin{itemize}
@@ -344,24 +344,24 @@ \section{Кольцо}
344344
\end{enumerate}
345345
\end{definition}
346346

347-
Заметим, что мультипликативное свойство $\bz$ (быть аннигилятором по умножению) не указыватеся явно, так как может быть выведено из остальных утверждений.
347+
Заметим, что мультипликативное свойство $\Bbbzero$ (быть аннигилятором по умножению) не указыватеся явно, так как может быть выведено из остальных утверждений.
348348
Действительно,
349349
\begin{enumerate}
350-
\item $a \otimes \bz = a \otimes (\bz \oplus \bz)$, так как $\bz$~--- нейтральный по сложению, то $\bz \oplus \bz = \bz$
351-
\item Воспользуемся дистрибутивностью: $a \otimes (\bz \oplus \bz) = a \otimes \bz \oplus a \otimes \bz$.
352-
В итоге: $a \otimes \bz = a \otimes \bz \oplus a \otimes \bz$
353-
\item Так как у нас есть группа по сложению, то для любого $a$ существует обратный элемент $a^{-1}$, $a \oplus a^{-1} = \bz$.
354-
Прибавим $a^{-1} \otimes \bz$ к левой и правой части равенства%
350+
\item $a \otimes \Bbbzero = a \otimes (\Bbbzero \oplus \Bbbzero)$, так как $\Bbbzero$~--- нейтральный по сложению, то $\Bbbzero \oplus \Bbbzero = \Bbbzero$
351+
\item Воспользуемся дистрибутивностью: $a \otimes (\Bbbzero \oplus \Bbbzero) = a \otimes \Bbbzero \oplus a \otimes \Bbbzero$.
352+
В итоге: $a \otimes \Bbbzero = a \otimes \Bbbzero \oplus a \otimes \Bbbzero$
353+
\item Так как у нас есть группа по сложению, то для любого $a$ существует обратный элемент $a^{-1}$, $a \oplus a^{-1} = \Bbbzero$.
354+
Прибавим $a^{-1} \otimes \Bbbzero$ к левой и правой части равенства%
355355
\sidenote{Обычно данное действие воспринимается как очевидное, но, строго говоря, оно требует аккуратного введения структур с равенством и соответствующих аксиом.}%
356356
, полученного на предыдущем шаге:
357-
\[a \otimes \bz \oplus a^{-1} \otimes \bz = a \otimes \bz \oplus a \otimes \bz \oplus a^{-1} \otimes \bz.\]
357+
\[a \otimes \Bbbzero \oplus a^{-1} \otimes \Bbbzero = a \otimes \Bbbzero \oplus a \otimes \Bbbzero \oplus a^{-1} \otimes \Bbbzero.\]
358358
\item Воспользуемся дистрибутивностью и ассоциативностью.
359359
\begin{align*}
360-
(a \oplus a^{-1}) \otimes \bz & = a \otimes \bz \oplus (a \oplus a^{-1}) \otimes \bz \\
361-
\bz \otimes \bz & = a \otimes \bz \oplus \bz \otimes \bz \\
362-
\bz & = a \otimes \bz
360+
(a \oplus a^{-1}) \otimes \Bbbzero & = a \otimes \Bbbzero \oplus (a \oplus a^{-1}) \otimes \Bbbzero \\
361+
\Bbbzero \otimes \Bbbzero & = a \otimes \Bbbzero \oplus \Bbbzero \otimes \Bbbzero \\
362+
\Bbbzero & = a \otimes \Bbbzero
363363
\end{align*}
364-
\item Аналогично можно доказать, что $\bz = \bz \otimes a$.
364+
\item Аналогично можно доказать, что $\Bbbzero = \Bbbzero \otimes a$.
365365
\end{enumerate}
366366

367367
%\section{Поле}

tex/figures/graph/graph0.tex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state] (q_0) at (T60.right corner) {$0$};
10+
\node[state] (q_1) at (T60.left corner) {$1$};
11+
\node[state] (q_2) at (T60.apex) {$2$};
12+
\node[state] (q_3) [right=1.5 of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge[left] node {a} (q_1)
15+
(q_1) edge[above] node {a} (q_2)
16+
(q_2) edge[below] node {a} (q_0)
17+
(q_2) edge[bend left, above] node {b} (q_3)
18+
(q_3) edge[bend left, below] node {b} (q_2);
19+
\end{tikzpicture}

tex/figures/graph/graph1.tex

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state] (q_0) at (T60.right corner) {$0$};
10+
\node[state] (q_1) at (T60.left corner) {$1$};
11+
\node[state] (q_2) at (T60.apex) {$2$};
12+
\node[state] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[]
14+
(q_0) edge (q_1)
15+
(q_1) edge (q_2)
16+
(q_2) edge (q_0)
17+
(q_2) edge (q_3);
18+
\end{tikzpicture}

tex/figures/graph/graph2.tex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state] (q_0) at (T60.right corner) {$0$};
10+
\node[state] (q_1) at (T60.left corner) {$1$};
11+
\node[state] (q_2) at (T60.apex) {$2$};
12+
\node[state] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge (q_1)
15+
(q_1) edge (q_2)
16+
(q_2) edge (q_0)
17+
(q_2) edge [bend left] (q_3)
18+
(q_3) edge [bend left] (q_2);
19+
\end{tikzpicture}

tex/figures/graph/graph3.tex

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state] (q_0) at (T60.right corner) {$0$};
10+
\node[state] (q_1) at (T60.left corner) {$1$};
11+
\node[state] (q_2) at (T60.apex) {$2$};
12+
\node[state] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge[left] node {$\{a\}$} (q_1)
15+
(q_1) edge[above] node {$\{a\}$} (q_2)
16+
(q_2) edge[below] node {$\{a\}$} (q_0)
17+
(q_2) edge[bend left = 15, above] node {$\{a\}$} (q_3)
18+
(q_2) edge[bend left = 65, above] node {$\{b\}$} (q_3)
19+
(q_3) edge[bend left, below] node {$\{b\}$} (q_2);
20+
\end{tikzpicture}

tex/figures/graph/graph4.tex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state] (q_0) at (T60.right corner) {$0$};
10+
\node[state] (q_1) at (T60.left corner) {$1$};
11+
\node[state] (q_2) at (T60.apex) {$2$};
12+
\node[state] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge[left] node {$-1.4$} (q_1)
15+
(q_1) edge[above] node[yshift=5pt] {$2.2$} (q_2)
16+
(q_2) edge[below] node[yshift=-5pt] {$0.5$} (q_0)
17+
(q_2) edge[bend left, above] node {$1.85$} (q_3)
18+
(q_3) edge[bend left, below] node {$-0.76$} (q_2);
19+
\end{tikzpicture}

tex/figures/graph/graph5.tex

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state] (q_0) at (T60.right corner) {$0$};
10+
\node[state] (q_1) at (T60.left corner) {$1$};
11+
\node[state] (q_2) at (T60.apex) {$2$};
12+
\node[state] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge[loop below] node {} ()
15+
edge node {} (q_1)
16+
edge[bend right] node {} (q_2)
17+
edge[bend right = 55] node {} (q_3)
18+
(q_1) edge[loop above] node {} ()
19+
edge[bend right] node {} (q_0)
20+
edge node {} (q_2)
21+
edge[bend left = 55, above] node {} (q_3)
22+
(q_2) edge[loop below] node {} ()
23+
edge[bend right] node {} (q_1)
24+
edge node {} (q_0)
25+
edge[bend left, above] node {} (q_3)
26+
(q_3) edge[loop above] node {} ()
27+
edge[bend left, below] node {} (q_2)
28+
edge[bend left, below] node {} (q_0)
29+
edge[bend right, below] node {} (q_1)
30+
;
31+
\end{tikzpicture}

tex/figures/graph/graph_BFS_1.tex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state,fill=yellow] (q_0) at (T60.right corner) {$0$};
10+
\node[state] (q_1) at (T60.left corner) {$1$};
11+
\node[state,fill=green] (q_2) at (T60.apex) {$2$};
12+
\node[state,fill=yellow] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge (q_1)
15+
(q_1) edge (q_2)
16+
(q_2) edge (q_0)
17+
(q_2) edge [bend left] (q_3)
18+
(q_3) edge [bend left] (q_2);
19+
\end{tikzpicture}

tex/figures/graph/graph_BFS_2.tex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state,fill=green] (q_0) at (T60.right corner) {$0$};
10+
\node[state,fill=yellow] (q_1) at (T60.left corner) {$1$};
11+
\node[state,fill=yellow, draw=red, line width=0.45mm] (q_2) at (T60.apex) {$2$};
12+
\node[state,fill=green] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge (q_1)
15+
(q_1) edge (q_2)
16+
(q_2) edge (q_0)
17+
(q_2) edge [bend left] (q_3)
18+
(q_3) edge [bend left] (q_2);
19+
\end{tikzpicture}

tex/figures/graph/graph_BFS_3.tex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state] (q_0) at (T60.right corner) {$0$};
10+
\node[state,fill=green] (q_1) at (T60.left corner) {$1$};
11+
\node[state,fill=yellow, draw=red, line width=0.45mm] (q_2) at (T60.apex) {$2$};
12+
\node[state] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge (q_1)
15+
(q_1) edge (q_2)
16+
(q_2) edge (q_0)
17+
(q_2) edge [bend left] (q_3)
18+
(q_3) edge [bend left] (q_2);
19+
\end{tikzpicture}

tex/figures/graph/graph_MS-BFS_1.tex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state] (q_0) at (T60.right corner) {$0$};
10+
\node[state,fill=green] (q_1) at (T60.left corner) {$1$};
11+
\node[state,fill=yellow] (q_2) at (T60.apex) {$2$};
12+
\node[state,fill=green] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge (q_1)
15+
(q_1) edge (q_2)
16+
(q_2) edge (q_0)
17+
(q_2) edge [bend left] (q_3)
18+
(q_3) edge [bend left] (q_2);
19+
\end{tikzpicture}

tex/figures/graph/graph_MS-BFS_2.tex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
\begin{tikzpicture}[]
2+
% Apex angle 60 degrees
3+
\node[isosceles triangle,
4+
isosceles triangle apex angle=60,
5+
draw=none,fill=none,
6+
minimum size=2cm] (T60) at (3,0){};
7+
8+
9+
\node[state,fill=yellow] (q_0) at (T60.right corner) {$0$};
10+
\node[state] (q_1) at (T60.left corner) {$1$};
11+
\node[state,fill=green] (q_2) at (T60.apex) {$2$};
12+
\node[state,fill=yellow, draw=red, line width=0.45mm] (q_3) [right=1.5cm of q_2] {$3$};
13+
\path[->]
14+
(q_0) edge (q_1)
15+
(q_1) edge (q_2)
16+
(q_2) edge (q_0)
17+
(q_2) edge [bend left] (q_3)
18+
(q_3) edge [bend left] (q_2);
19+
\end{tikzpicture}

tex/figures/graph/path0.tex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
\begin{tikzpicture}[on grid, auto]
2+
\node[state] (v_0) {$v_0$};
3+
\node[state] (v_n) [right=2 of v_0] {$v_n$};
4+
\path[->]
5+
(v_0) edge [out=45] node {$\pi$} (v_n);
6+
\end{tikzpicture}

tex/main.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
fontsize=10pt,
33
a4paper,
44
twoside=false,
5-
parskip=false
5+
parskip=false,
66
]{kaobook}
77

88
\input{styles/language.tex}
@@ -44,6 +44,7 @@
4444
\pagelayout{margin} % Restore margins
4545

4646
\input{LinearAlgebra}
47+
\input{GraphTheoryIntro}
4748

4849
\backmatter
4950
\setchapterstyle{plain}

0 commit comments

Comments
 (0)