Ds 9 Graph Intro
Ds 9 Graph Intro
Nguyen An Khuong,
Tran Tuan Anh, Mai
Chapter 9
Xuan Toan, Tran Hong
Tai
Introduction to Graphs
Discrete Structures for Computing on June 16, 2024
Contents
Graph definitions
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
Nguyen An Khuong, Tran Tuan Anh, Mai Xuan Toan, Tran Hong
Tai
Faculty of Computer Science and Engineering
University of Technology - VNUHCM
[email protected]
9.1
Contents Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
1 Graph definitions
Terminology
Special Graphs
Bipartie graph Contents
Graph definitions
2 Special Graphs
Bipartie graph
Graph Isomorphism
3 Exercise Exercise
Graph
Graph Isomorphism
Isomorphism
9.2
Course outcomes Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
Representing Graphs
L.O.3 Understanding of basic probability and random variables and Graph
Isomorphism
L.O.3.1 Define basic probability theory Representing Graphs
Exercise
L.O.4 Compute quantities of discrete structures and probabilities Graph
9.3
Motivations Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
Representing Graphs
and Graph
Isomorphism
• Graph theory is useful for analysing "things that are Representing Graphs
Graph Isomorphism
a graph.
9.4
Graph Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Definition
A graph (ç thà ) G is a pair of (V, E ), which are:
• V nonempty set of vertices (nodes) (¿nh)
Contents
• E set of edges (c¤nh) Graph definitions
Terminology
Bipartie graph
Representing Graphs
2 4 2 4 and Graph
Isomorphism
Representing Graphs
1 3
Graph Isomorphism
1 3 Exercise
Graph
9.5
Undirected Graph (ç thà væ h÷îng) Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.6
Undirected Graph Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.7
Undirected Graph Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.8
Terminologies For Undirected Graph Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Neighborhood
In an undirected graph G = (V, E),
• two vertices u and v ∈ V are called adjacent (li·n k· ) if they
are end-points (iºm ¦u mót ) of edge e ∈ E , and
• e is incident with (c¤nh li¶n thuëc ) u and v
Contents
Graph definitions
• e is said to connect (c¤nh nèi ) u and v; Terminology
Special Graphs
Bipartie graph
Representing Graphs
The degree of a vertex and Graph
Isomorphism
The degree of a vertex (bªc cõa mët ¿nh), denoted by deg(v) is Representing Graphs
Graph Isomorphism
the number of edges incident with it, except that a loop Exercise
contributes twice to the degree of that vertex. Graph
Isomorphism
9.9
Example Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Contents
Graph definitions
Terminology
a f e g e d Special Graphs
Bipartie graph
G H Representing Graphs
and Graph
Isomorphism
Representing Graphs
Exercise
In G, deg(a) = 2, deg(b) = deg(c) = deg(f ) = 4, deg(d) = 1, . . . Graph
Nguyen An Khuong,
(Note that this applies even if multiple edges and loops are Contents
Graph definitions
present.) Terminology
Special Graphs
Example
Bipartie graph
Representing Graphs
and Graph
What are the degrees and neighborhoods of the vertices in these Isomorphism
graphs?
Representing Graphs
Graph Isomorphism
b c d a b c Exercise
Graph
Isomorphism
a f e g e d
G H
9.11
Prove that ... Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Theorem
An undirected graph has an even number of odd-degree vertices.
...
Contents
If the number of vertices in an undirected graph is an odd number,
Graph definitions
then there exists an even-degree vertex. Terminology
Special Graphs
Bipartie graph
Graph Isomorphism
Exercise
... Graph
Isomorphism
9.12
Exercise Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Exercise (2)
Contents
Is there any undirected simple graph including six vertices that Graph definitions
their degree are respectively 2, 3, 3, 3, 3, 3 ? Terminology
Special Graphs
Bipartie graph
and other vertices having degree 3. What is the number of vertices Graph Isomorphism
Exercise
of the graph G? Graph
Isomorphism
Exercise (4)
Is it possible that each person has exactly 5 friends in the same
group of 9 people ?
9.13
Exercise Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Exercise (6)
Give an undirected simple graph G = (V, E) with |V | = n, show Contents
that Graph definitions
Terminology
Bipartie graph
b) there does not exist simultaneously both a vertex of degree 0 Representing Graphs
and Graph
and a vertex of degree (n − 1), Isomorphism
deduce that there are at least two vertices of the same degree.
Representing Graphs
c) Graph Isomorphism
Exercise
Graph
Isomorphism
9.14
Directed Graph Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
A directed edge start at u and end at v is denoted as (u, v). Graph definitions
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.15
Terminologies for Directed Graph Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Special Graphs
Bipartie graph
Representing Graphs
The degree of a vertex and Graph
Isomorphism
In a graph G with directed edges: Representing Graphs
Exercise
the number of edges with v as their terminal vertex. Graph
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Theorem
Let G = (V, E) be a graph with directed edges. Then
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.17
Complete Graphs Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
graph that contains exactly one edge between each pair of distinct
vertices.
Contents
Graph definitions
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
K5 K4
Exercise
What is the largest number of edges a undirected simple graph
with 10 vertices can have? Kn can have?
9.18
Complement Graphs Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.19
Cycles Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
C5 C4
9.20
Wheels Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
W5 W4
9.21
n-cube
Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Bipartie graph
Representing Graphs
and Graph
Isomorphism
010 011
0 1 Representing Graphs
Graph Isomorphism
Exercise
00 01 000 001 Graph
Isomorphism
Q1 Q2 Q3
What's about Q4 ?
9.22
Applications of Special Graphs Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
• Linear array
Bipartie graph
Representing Graphs
• Mesh network and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.23
Graph Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
the cabbage?
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.24
Bipartite Graphs Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Definition Tai
A simple graph G is called bipartite (ç thà ph¥n æi ) if its vertex
set V can be partitioned into two disjoint sets V1 and V2 such that
every edge in the graph connects a vertex in V1 and a vertex in V2
(so that no edge in G connects either two vertices in V1 or two
vertices in V2 ) Contents
Graph definitions
Terminology
Bipartie graph
Graph Isomorphism
Exercise
Graph
Isomorphism
C6
9.25
Complete Bipartite Graphs Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Definition
A complete bipartite Km,n is a graph that
• has its vertex set partitioned into two subsets of m and n
vertices, respectively,
• with an edge between two vertices iff one vertex is in the first Contents
Graph definitions
subset and the other is in the second one Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
K3,3
9.26
Bipartite graphs Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.27
Bipartie graph Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Contents
Graph definitions
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.28
New Graph From Old Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Definition
A subgraph (ç thà con) of a graph G = (V, E) is a graph
H = (W, F ) where W ⊆ V and F ⊆ E .
Definition Contents
G2 = (V2 , E2 ) is a simple graph with vertex set V1 ∪ V2 and edge Special Graphs
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
G1 G2 G1 ∪ G2
9.29
Planar Graphs Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Contents
Graph definitions
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.30
Planar Graphs Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Definition
• A graph is called planar (ph¯ng ) if it can be drawn in the
plane without any edges crossing.
• Such a drawing is called planar representation (biºu di¹n
ph¯ng ) of the graph. Contents
Graph definitions
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
K4 K4 with no crossing
9.31
Example Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Example
• Is K5 planar?
• Is Q3 planar?
100 101
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
010 011 Representing Graphs
Graph Isomorphism
Exercise
Graph
K5 Q3
9.32
Important Corollaries Introduction to Graphs
Nguyen An Khuong,
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.33
Elementary Subdivision Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Definition
• Given a planar graph G, an elementary subdivision (ph¥n chia
sì c§p ) is removing an edge {u, v} and adding a new vertex
w together with edges {u, w} and {w, v}. Contents
• Graphs G1 = (V1 , E1 ) and G2 = (V2 , E2 ) are called Graph definitions
homeomorphic (çng phæi ) if they can obtained from the Terminology
Special Graphs
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.34
Kuratowski's Theorem Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Theorem
A graph is nonplanar iff it contains a subgraph homeomorphic to
K3,3 or K5 .
Contents
Graph definitions
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
K3,3 Exercise
Non-planar Graph
Isomorphism
K5
Non-planar
9.35
Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Example
A graph is nonplanar iff it contains a subgraph homeomorphic to
K3,3 .
Contents
a
Graph definitions
Terminology
f f d Special Graphs
c j Bipartie graph
e b
j g Representing Graphs
a g and Graph
Isomorphism
i h Representing Graphs
e Graph Isomorphism
i h Exercise
d c
Graph
Isomorphism
9.36
Adjacency Lists (Danh s¡ch k·) Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.37
Adjacency Matrices Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Definition Tai
Special Graphs
a b Bipartie graph
Representing Graphs
and Graph
Isomorphism
a b c d Representing Graphs
a 0 1 1 1 Graph Isomorphism
Exercise
b
1 0 1 0
Graph
c 1 1 0 0 Isomorphism
d 1 0 0 0
c d
9.38
Examples Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Example
Give the graph defined by the following adjacency matrix
Contents
A B C D E Graph definitions
Terminology
Special Graphs
A 0 0 1 1 0 Bipartie graph
Representing Graphs
B 0 0 0 1 0 and Graph
Isomorphism
C
1 0 0 1 0
Representing Graphs
D 1 1 1 0 1 Graph Isomorphism
Exercise
E 0 0 0 1 0
Graph
Isomorphism
9.39
Adjacency Matrices Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Example
Give the directed graph defined by the following adjacency matrix
Contents
A B C D E Graph definitions
Terminology
Special Graphs
A 1 0 1 1 0 Bipartie graph
Representing Graphs
B 0 0 0 0 0 and Graph
Isomorphism
C
1 0 0 0 0
Representing Graphs
D 1 1 1 0 1 Graph Isomorphism
Exercise
E 1 0 0 0 0
Graph
Isomorphism
9.40
Incidence Matrices Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Definition Tai
Special Graphs
a e2 b Bipartie graph
Representing Graphs
and Graph
Isomorphism
e1 e2 e3 e4 Representing Graphs
1 1 1 0
a Graph Isomorphism
Exercise
e1
e4 e3 b 0 1 0 1
Graph
1 0 0 1
c Isomorphism
d 0 0 1 0
c d
9.41
Examples Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Example
Give incidence matrix according to the following graph
Contents
F Graph definitions
Terminology
B C Special Graphs
Bipartie graph
Representing Graphs
and Graph
A Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
E D Graph
G Isomorphism
9.42
Graph Isomorphism Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Definition
G1 = (V1 , E1 ) and G2 = (V2 , E2 ) are isomorphic (¯ng c§u ) if
there is a one-to-one function f from V1 to V2 with the property
that a and b are adjacent in G1 iif f (a) and f (b) are adjacent in
G2 , for all a and b in V1 . Such a function f is called an Contents
Representing Graphs
and Graph
Isomorphism
u1 u2 v1 v2 Representing Graphs
Exercise
V with Graph
f (u3 ) = v3 f (u4 ) = v2
u3 u4 v3 v4
9.43
Isomorphism ? Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Contents
Graph definitions
Terminology
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
Exercise
Graph
Isomorphism
9.44
Isomorphism? Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
A
A B
Contents
B Graph definitions
Terminology
F C
Special Graphs
C Bipartie graph
Representing Graphs
and Graph
Isomorphism
D Representing Graphs
E D Graph Isomorphism
G2 Exercise
F E Graph
G1 Isomorphism
9.45
Isomorphism? Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
A1 A2 B2
Contents
Graph definitions
D1 E1 E2 F2 Terminology
Special Graphs
Bipartie graph
Representing Graphs
F1 and Graph
Isomorphism
Representing Graphs
Graph Isomorphism
C1 B1 D2 C2 Exercise
G1 G2 Graph
Isomorphism
9.46
Isomorphism Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Special Graphs
0 1 0 1 0 1 1 1 Bipartie graph
1 0 Representing Graphs
0 1 1 0 0 1 and Graph
2 Isomorphism
0 0 0 1 1 0 0 1 Representing Graphs
1 1 1 0 1 1 1 0 Graph Isomorphism
Exercise
0 1 1 0 0 1 0 1 Graph
1 0 0 1 1 0 0 0 Isomorphism
3
1 0 0 1 0 0 0 1
0 1 1 0 1 0 1 0
9.47
Isomorphism Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
1 1 0 0 1 1 Special Graphs
Bipartie graph
1 1 0 0 0 0 1 0 0 1 Representing Graphs
and Graph
• 1 0 1 0 1 0 1 1 1 0 Isomorphism
0 0 0 1 1 1 0 0 1 0 Representing Graphs
Graph Isomorphism
0 1 1 1 0 1 0 1 0 1
Exercise
• Extend the definition of isomorphism of simple graphs to Graph
9.48
Revision Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
B 1 0 0 1 0 B 1 1 0 1 0 0 0
Contents
1 0 0 1 0
C C 0 1 1 0 1 0 0
Graph definitions
1 1 1 0 1
D D 0 0 1 1 0 0 1
E 1 0 0 1 0 E 0 0 0 0 0 1 1 Terminology
Bipartie graph
Representing Graphs
A) Isomorphism. and Graph
Isomorphism
B) Non-isomorphism. Representing Graphs
Order.
Graph Isomorphism
C)
Exercise
D) Equivalence. Graph
Isomorphism
9.49
Revision Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
A) Bipartie graph
D)
Exercise
Graph
Isomorphism
9.50
Revision Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
A) Special Graphs
B)
Representing Graphs
and Graph
C) Khæng thº chùa ¿nh cæ lªp. Isomorphism
Tçn t¤i hai ¿nh trong ç thà câ còng sè bªc.
Representing Graphs
D) Graph Isomorphism
Isomorphism
9.51
Prove that ... Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
...
There are 101 invited people in a party.
Suppose that A knows B ⇒ B knows A.
Prove that
1 at least one people knows an even number of other people. Contents
2 at least two people who know the same number of people Graph definitions
Special Graphs
Bipartie graph
Representing Graphs
and Graph
Isomorphism
A chess tournament of n persons plays according to the circle Representing Graphs
Graph Isomorphism
9.52
Revision Introduction to Graphs
Nguyen An Khuong,
Tran Tuan Anh, Mai
Xuan Toan, Tran Hong
Tai
Contents
With any four of the n people (n ≥ 4), there exists a person who
Graph definitions
knows the three others. Prove that there exists a person who Terminology
Bipartie graph
Representing Graphs
and Graph
Isomorphism
In a party of 6 people, prove that there are 3 people who know Representing Graphs
Graph Isomorphism
Isomorphism