Mathematical Foundations of Computer Science Lecture Outline
Mathematical Foundations of Computer Science Lecture Outline
Lecture Outline
October 2, 2018
Graphs
A graph consists of two sets, a non-empty set, V , of vertices or nodes, and a possibly
empty set, E, of 2-element subsets of V . Such is graph is denoted by G = (V, E). Each
element of E is called an edge. We say that an edge {u, v} ∈ E connects vertices u and
v. Two nodes u and v are adjacent if {u, v} ∈ E. Nodes adjacent to a vertex u are called
neighbors of u. The number of neighbors of a vertex v is called the degree of v and is
denoted by deg(v). The value δ(G) = minv∈V {deg(v)} is the minimum degree of G, the
value ∆(G) = maxv∈V {deg(v)} is the maximum degree of G. An edge that connects a node
to itself is called a loop and multiple edges between the same pair of nodes are called parallel
edges. Graphs without loops and parallel edges are called simple graphs, otherwise they
are called multigraphs. Unless specified otherwise, we will only deal with simple graphs.
Example. Prove that the sum of degrees of all nodes in a graph is twice the number of
edges.
Solution. Since each edge is incident to exactly two vertices, each edge contributes two to
the sum of degrees of the vertices. The claim follows.
Example. In any graph there are an even number of vertices of odd degree.
Solution. Let Ve and Vo be the set of vertices with even degree and the set of vertices with
odd degree respectively in a graph G = (V, E). Then,
X X X
deg(v) = deg(v) + deg(v)
v∈V v∈Ve v∈Vo
The first term on R.H.S. is even since each vertex in Ve has an even degree. From the
previous example, we know that L.H.S. of the above equation is even. Thus the second
term on the R.H.S. must be even. Let |Vo | = `. We want to show that ` is even. Since each
vertex in Vo has odd degree, we have
We say that H is an induced subgraph of a graph G if the vertex set of H is a subset of the
vertex set of G, and if u and v are vertices in H, then (u, v) is an edge in H iff (u, v) is an
edge in G.
Example. Prove that every graph with n vertices and m edges has at least n − m con-
nected components.
Example. Prove that every connected graph with n vertices has at least n − 1 edges.
Solution. We will prove the contrapositive, i.e., a graph G with m ≤ n−2 edges is discon-
nected. From the result of the previous problem, we know that the number of components
of G is at least
n − m ≥ n − (n − 2) = 2
October 2, 2018 Lecture Outline 3
One could also have proved the above claim directly by observing that a connected graph
has exactly one connected component. Hence, 1 ≥ n − m. Rearranging the terms gives us
m ≥ n − 1.