You are on page 1of 29

Discrete Mathematics

Lecture 8 - Graphs

Nurlan Ismailov
nurlan.ismailov@astanait.edu.kz

Astana IT University

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 1 / 29
What is Lecture 8 about?

Introduction: Graphs and subgraphs


Complete and Bipartite graphs
The Number of Edges: The Euler’s Theorem. The Degree Sequence
Isomorphism of Graphs

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 2 / 29
1. Introduction: Graphs and subgraphs

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 3 / 29
A Gentle Introduction

Last topic in our course which we will study in next three lectures is graphs.
Many concrete, practical problems can be simplified and solved by looking at
them from different of view. Sometimes the process of abstraction is simple.
For example, we use a logic to design a computer circuits. Another example -
scheduling final exams. For successful scheduling we have to take into account
associations between courses, students and rooms. Such set of connections
between items is modeled by graphs.

The basic idea of graphs were introduced in 18th century by the great Swiss
mathematician Leonhard Euler. He used graphs to solve the famous Königs-
berg bridge problem (Königsberg was the capital of East Prussia, that is now
Kaliningrad, Russia).

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 4 / 29
Königsberg bridge problem

Seven bridges crossed


the river, providing links
among the four land masses
labeled A, B, C, D in the
figure. People wondered if it
were possible to start on one
of the land masses, walk over
each of the seven bridges
exactly once, and return to the starting point (without getting wet).

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 5 / 29
For Königsberg bridge
problem, Euler’s idea was
to realize that the physical
layout of land, water, and
bridges could be modeled
by the graph shown in the
figure. The land masses are
represented by small circles
(or vertices) and bridges
by lines (or edges), which
can be straight or curved.
By means of this graph, the
physical problem in transformed into this mathematical one. Given the graph
in the Figure, is it possible to choose a vertex, then to proceed along the edges
one after the other and return to the chosen a vertex, covering every edge
exactly once?

Euler was able to show that this was not possible.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 6 / 29
The Three Houses - Three Utilities Problem

The Three Houses


- Three Utilities Problem
is another physical situation
that can be modeled
by means of a graph. There
are three houses, each of
which is to be connected to
each of three utilities (water,
electricity, and telephone) by
means of underground pipes.
Is it possible to make these connections without any crossovers?

The houses and the utilities are represented by vertices and the pipes are the
lines drawn between the vertices. When we discuss planar graphs in next
lectures (Chapter 13, Lecture 10).

We shall see that the answer to our question is no.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 7 / 29
Definitions and Basic Properties

Definitions and Notations


A graph is a pair (V, E) of sets, V nonempty and each element of E a set
of two distinct elements of V. The elements of V are called vertices; the
elements of E are called edges. Thus, if e is an edge, then e = vw, where v
and w are different elements of V.
The vertices v and w are said to be incident with the edge vw; Two
vertices are adjacent if they are the end vertices of an edge; two edges are
adjacent if they have a vertex in common.
The number of edges incident with a vertex v is called the degree of that
vertex and is denoted deg v. If deg v is an even number, then v is said to
be an even vertex; if deg v is an odd number, then vertex v is odd. A
vertex of degree 0 is said to be isolated.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 8 / 29
Example

The graph G = (V, E) with vertices V = {v1 , v2 , v3 , v4 , v5 , v6 } and edges


E = {v1 v4 , v1 v6 , v2 v5 , v4 v5 , v5 v6 }
can be described as follows.
v1 v2 v3

v4 v5 v6

For instance, v1 and v4 are incident with the edge v1 v4 . v1 and v4 are
adjacent. The edges v1 v4 and v4 v5 are adjacent.
deg v1 = 2, deg v2 = 1, deg v3 = 0, deg v4 = 2, deg v5 = 3, deg v6 = 2.

Correspondingly, v1 , v3 , v4 , v6 are even, and v2 , v5 are odd vertices,


v3 is an isolated vertex.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 9 / 29
Edges incident
with the same two vertices
are called multiple edges.

An edge
that is incident with only
one vertex is called a loop.

A pseudograph is like
a graph, but it may contain
loops and/or multiple edges.

For instance, in the


figure e1 and e2 are multiple
edges, because v1 and v2 are
incident with edges e1 and e2 . The edge e5 is a loop, because it is incident
only with vertex v3 .
Counting the loop incident with v3 twice (as it enters and leaves)
deg v3 = 4.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 10 / 29
Subgraphs

Definition
A graph G1 is a subgraph of another graph G if and only if the vertex and edge
sets of G1 are, respectively, subsets of vertex and edge sets of G.

Example
The graphs G1 , G2 , G3 are subgraphs of G
v1
v2 v3 v2
v7
v1 v7
v1 v2
v7 v5
v1 v4 v3 v2 v3

v5 v6 v4 v6 v6 v4 v5 v7

G G1 G2 G3
Nurlan Ismailov nurlan.ismailov@astanait.edu.kz
Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 11 / 29
2. Complete and Bipartite graphs

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 12 / 29
Kn

Definition
For any positive integer n, the complete graph on n vertices, denoted Kn , is
that graph with n vertices every two of which are adjacent.

K1 K2 K3 K4 K5
The first five complete graphs

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 13 / 29
Km,n

Definition
A bipartite graph is one whose vertices can be partitioned into two
(disjoint) sets V1 and V2 , called bipartition sets, in such a way that every
edge joins a vertex in V1 and a vertex in V2 . (In particular, there are no
edges within V1 nor within V2 .)
A complete bipartite graph is a bipartite graph in which every vertex in V1
is joined to every vertex in V2 . The complete bipartite graph on
bipartition sets of m vertices and n vertices, respectively, is denoted Km,n .

K2,3 K3,3

Three bipartite graphs, two of which are complete bipartite.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 14 / 29
v2 v3 v1 v3 v5 v7

v1
v4

v8 v5

v7 v6 v2 v4 v6 v8

The same graph is drawn in two different ways. So the graph on the left is a
bipartite graph.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 15 / 29
3. The Number of Edges: The Euler’s Theorem.
The Degree Sequence

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 16 / 29
The number of edges

Proposition (Euler)
The sum of the degrees of the vertices of a pseudograph is an even number
equal to twice the number of edges. In symbols, if G = (V, E) is a
pseudograph, then
P
v∈V deg v = 2|E|.

Proof.
Adding the degrees of all the vertices involves counting one for each edge incident
with each vertex. How many times does an edge get counted? If it is not a
loop, it is incident with two different vertices and so gets counted twice, once
at each vertex. On the other hand, a loop at a vertex is also counted twice, by
convention, in the degree of that vertex. □

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 17 / 29
Examples
1. The pseudograph in the figure below has eight vertices each of degree 3.
P
Since v∈V deg v = 8(3) = 24 = 2|E|, |E| = 12 edges.
v2 v3

v1
v4

v8 v5

v7 v6

2. How many edges does K3,6 contain?


Solution. This complete bipartite graph has six vertices of degree 3 and three
of degree 6. Since
P
v∈V deg v = 6(3) + 3(6) = 36 = 2|E|.

K3,6 has 18 edges.


Nurlan Ismailov nurlan.ismailov@astanait.edu.kz
Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 18 / 29
Corollary
The number of odd vertices in a pseudograph is even.

Proof.
P
By the previous Proposition, v∈V deg v = 2|E| is an even number. Since
P P P
v∈V deg v = v∈V,v is even deg v + v∈V,v is odd deg v

and the first sum on the right, being a sum of even numbers, is even, so also the
second sum must be even. Since the sum of an odd number of odd numbers is
odd, the number of terms in the sum here, that is, the number of odd vertices,
must be even. □

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 19 / 29
Examples

1. The complete bipartite graph K3,6 has six odd vertices (each of degree 3).

2. The graph in the figure has two odd vertices, v2 and v4 .

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 20 / 29
The degree sequence

Definition
Suppose that d1 , d2 , . . . , dn are the degrees of the vertices of a graph (or
pseudograph) G, ordered so that d1 ≥ d2 ≥ · · · ≥ dn . Then d1 , d2 , . . . , dn is
called the degree sequence of G.

For instance,

The degree sequence


of the pseudograph
in the figure is 4, 3, 2, 1.
K2,3 has degree
sequence 3, 3, 2, 2, 2.
Does there exist
a pseudograph with a degree
sequence 5, 4, 4, 3, 2, 1?
Answer: No.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 21 / 29
4. Isomorphism of Graphs

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 22 / 29
Isomorphism ∼
=

It is important to know when two graphs are essentially the same and when
they are essentially different. When we say graphs are “essentially the same”,
we mean that they differ only in the way they are labeled or drawn.

There should be a one-to-one correspondence between the vertices of the graphs


and a one-to-one correspondence between their edges such that corresponding
vertices are incident with corresponding edges. The proper term for “essentially
the same” is isomorphic.

There is a distinction between a graph and its picture. A graph is a set of V


and a set E of unordered pairs of elements of V. A picture of it consists of dots
and lines that can be drawn and arranged in many different ways.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 23 / 29
Examples

1. As we have seen the bipartite graphs below, are isomorphic.


v2 v3 v1 v3 v5 v7

v1
v4

v8 v5

v7 v6 v2 v4 v6 v8

2. G1 = G2 = G3 =

G2 and G3 are isomorphic, but neither is isomorphic to G1 .

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 24 / 29
Examples

3.

two nonisomorphic graphs.


4.
A D A D

B C C B

Two graphs labeled so as to show that they are isomorphic.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 25 / 29
Isomorphism definition

Definition
Given graphs G1 = (V1 , E1 ) and G2 = (V2 , E2 ), we say that G1 is isomorphic to
G2 and write G1 ∼
= G2 if there is a one-to-one function φ from V1 onto V2 such
that
if vw is an edge in E1 , then φ(v)φ(w) is an edge in E2 , and
every edge in E2 has the form φ(v)φ(w) for some edge vw ∈ E1 .
We call φ an isomorphism from G1 to G2 and, abusing notation, say that
φ : G1 → G2 is an isomorphism.

The definition of isomorphism is symmetric. (Why?). If G1 is isomorphic to G2 ,


then G2 is isomorphic to G1 .
In fact, if φ : G1 → G2 is an isomorphism, then φ−1 : G2 → G1 is an isomorphism.
Thus, there is no ambiguity if we simply say that two graphs “are isomorphic”.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 26 / 29
Example

A D u w

B C v x

G1 G2
It is easy to write down the isomorphism G2 → G1 explicitly:
φ(u) = A, φ(v) = C, φ(w) = D, φ(x) = B.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 27 / 29
Properties of isomorphism of graphs

Proposition
The isomorphism relation in a set of graphs is an equivalence relation.

Proposition
If G1 and G2 are isomorphic graphs, then G1 and G2 have the
same number of vertices,
same number of edges and
same degree sequences.

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 28 / 29
The End of Lecture 8

Nurlan Ismailov nurlan.ismailov@astanait.edu.kz


Discrete Mathematics
(Astana IT University)
Lecture 8 - Graphs 29 / 29

You might also like