133 lines
3.1 KiB
TeX
133 lines
3.1 KiB
TeX
\section{Graphs}
|
|
|
|
\definition{}
|
|
A \textit{set} is an unordered collection of objects. \par
|
|
This means that the sets $\{1, 2, 3\}$ and $\{3, 2, 1\}$ are identical.
|
|
|
|
|
|
\definition{}
|
|
A \textit{graph} $G = (N, E)$ consists of two sets: a set of \textit{vertices} $V$, and a set of \textit{edges} $E$. \par
|
|
Vertices are simply named \say{points,} and edges are connections between pairs of vertices. \par
|
|
In the graph below, $V = \{a, b, c, d\}$ and $E = \{~ (a,b),~ (a,c),~ (a,d),~ (c,d) ~\}$.
|
|
|
|
\begin{center}
|
|
\begin{tikzpicture}
|
|
\begin{scope}[layer = nodes]
|
|
\node[main] (a) at (0, 0) {$a$};
|
|
\node[main] (b) at (0, -1) {$b$};
|
|
\node[main] (c) at (2, -1) {$c$};
|
|
\node[main] (d) at (4, 0) {$d$};
|
|
\end{scope}
|
|
|
|
\draw[-]
|
|
(a) edge (b)
|
|
(a) edge (c)
|
|
(a) edge (d)
|
|
(c) edge (d)
|
|
;
|
|
\end{tikzpicture}
|
|
\end{center}
|
|
|
|
Vertices are also sometimes called \textit{nodes}. You'll see both terms in this handout. \par
|
|
|
|
|
|
|
|
\problem{}
|
|
Draw the graph defined by the following vertex and edge sets: \par
|
|
$V = \{A,B,C,D,E\}$ \par
|
|
$E = \{~ (A,B),~ (A,C),~ (A,D),~ (A,E),~ (B,C),~ (C,D),~ (D,E) ~\}$\par
|
|
|
|
\vfill
|
|
|
|
|
|
We can use graphs to solve many different kinds of problems. \par
|
|
Most situations that involve some kind of \say{relation} between elements can be represented by a graph.
|
|
|
|
\pagebreak
|
|
|
|
|
|
Graphs are fully defined by their vertices and edges. The exact position of each vertex and edge doesn't matter---only which nodes are connected to each other. The same graph can be drawn in many different ways.
|
|
|
|
|
|
\problem{}
|
|
Show that the graphs below are equivalent by comparing the sets of their vertices and edges.
|
|
|
|
\begin{center}
|
|
\adjustbox{valign=c}{
|
|
\begin{tikzpicture}
|
|
\begin{scope}[layer = nodes]
|
|
\node[main] (a) at (0, 0) {$a$};
|
|
\node[main] (b) at (2, 0) {$b$};
|
|
\node[main] (c) at (2, -2) {$c$};
|
|
\node[main] (d) at (0, -2) {$d$};
|
|
\end{scope}
|
|
|
|
\draw[-]
|
|
(a) edge (b)
|
|
(b) edge (c)
|
|
(c) edge (d)
|
|
(d) edge (a)
|
|
(a) edge (c)
|
|
(b) edge (d)
|
|
;
|
|
\end{tikzpicture}
|
|
}
|
|
\hspace{20mm}
|
|
\adjustbox{valign=c}{
|
|
\begin{tikzpicture}
|
|
\begin{scope}[layer = nodes]
|
|
\node[main] (a) at (0, 0) {$a$};
|
|
\node[main] (b) at (-2, -2) {$b$};
|
|
\node[main] (c) at (0, -2) {$c$};
|
|
\node[main] (d) at (2, -2) {$d$};
|
|
\end{scope}
|
|
|
|
\draw[-]
|
|
(a) edge (b)
|
|
(b) edge (c)
|
|
(c) edge (d)
|
|
(d) edge (a)
|
|
(a) edge (c)
|
|
(b) edge[out=270, in=270, looseness=1] (d)
|
|
;
|
|
\end{tikzpicture}
|
|
}
|
|
\end{center}
|
|
\vfill
|
|
\pagebreak
|
|
|
|
|
|
\definition{}
|
|
The degree $D(v)$ of a vertex $v$ of a graph
|
|
is the number of the edges of the graph
|
|
connected to that vertex.
|
|
|
|
|
|
\theorem{Handshake Lemma}<handshake>
|
|
In any graph, the sum of the degrees of its vertices equals twice the number of the edges.
|
|
|
|
|
|
\problem{}
|
|
Prove \ref{handshake}.
|
|
\vfill
|
|
|
|
|
|
\problem{}
|
|
Show that all graphs have an even number number of vertices with odd degree.
|
|
\vfill
|
|
|
|
|
|
\problem{}
|
|
One girl tells another, \say{There are 25 kids
|
|
in my class. Isn't it funny that each of them
|
|
has 5 friends in the class?} \say{This cannot be true,} immediately replies the other girl.
|
|
How did she know?
|
|
|
|
|
|
\vfill
|
|
|
|
\problem{}
|
|
Say $G$ is a graph with nine vertices. Show that $G$ has at least five vertices of degree six or at least six vertices of degree 5.
|
|
|
|
\vfill
|
|
\pagebreak |