You are on page 1of 58

Concept of Graphs

Discrete Math 2
Content
• Graph definition
• Some basic terms on undirected graphs
• Some basic terms on directed graphs
• Some special types of graphs
– Flat graph
– Two-sided graph
• Exercise

2
Graph definition
Single undirected graph
• Single scalar graph G= < V, E>, V is the set of vertices, E is the
unordered set of two different elements of V called edges.

4
Undirected multigraph
• The undirected multigraph G = <V, E> consists of V as the set
of vertices, E as the family of unordered pairs of two different
elements of V called the set of edges.
• e1  E, e2  E are said to be multiple edges (cạnh bội) if they
correspond to a pair of vertices.

5
Pseudo-undirected graph
• Pseudo-undirected graph G = <V, E> includes V as the set of
vertices, E as the family of unordered pairs of two elements
(two elements are not necessarily different) in V called edges.
• Edge e is called earring if there is the form e =( u, u ), where u
is some vertex in V .

6
Directed Graph
• A single directed graph G = <V, E> includes V as a set of
vertices, E is a set of ordered pairs of two elements of V called
arcs.

7
Directed multigraph
• The directed multigraph G = <V, E> includes V as the set of
vertices, E is an ordered pair of two elements of V called arcs.
• Two arcs e1, e2 corresponding to the same pair of vertices are
called repeating arcs .

8
Distinguish different types of graphs
Type thing market Edge Has a multiple Have earring
edge
Single undirected graph Directionless No No

Undirected multigraph Directionless Yes No

Pseudo-undirected graph Directionless Yes Yes

Directed Graph Have direction No No

Directed multigraph Have direction Yes Yes

9
Convention
• We mainly work with undirected and directed graphs.
• When writing "undirected graph" we understand as "single
undirected graph".
• When writing "directed graph" we understand as "single
directed graph".

10
Some basic terms on undirected graphs
Degree of the vertex
• Definition 1. Two vertices u and v of an undirected graph G =<V, E> are said to be
adjacent if (u,v) is an edge in the graph G.
– If e =(u, v) is an edge of a graph G, then we say that this edge belongs to two vertices u and v, or
we say that edge e connects vertex u to v, and vertices u and v will be called is the leading vertex
of the edge (u,v).
• Definition 2. We call the degree of vertex v in an undirected graph the number of
edges associated with it and denoted by deg(v).

12
Ex

• deg(a) = 2, deg(b) =deg(c) = deg(f) = 4;


• deg(e) = 3, deg(d) = 1, deg(g)=0.
• Vertex with degree 0 is called an isolated vertex (g).
• Vertex with degree 1 are called (hanging) pendant vertex (d).
13
Sum of degrees of vertices
• Theorem 1. Suppose G = <V, E> is an undirected graph with m
edges. Then :

• Consequences. In an undirected graph G=<V, E>, the number


of odd degree vertices is an even number.

14
Path, cycle
• Definition 1. Path of length n from vertex u to vertex v on an undirected graph
G=<V,E> is sequence x 0 , x 1 ,..., x n-1 , x n , where n is the number positive integer,
x0=u, xn=v, (xi , xi+1 )  E, i=0,1,2,...,n-1.
• The path above can also be represented as a sequence of edges (x0, x1),
(x1,x2),...,(xn-1, xn).
• The vertex u is the first vertex and v the vertex of the path.
• The path whose first vertex coincides with the last vertex (u=v) is called a cycle .
• A path or cycle is said to be simple if no edges repeat.

15
Ex
• a, d, c, f, e are simple paths of length 4.
• d, e, c, a are not paths because (e,c) is not an edge of the graph.
• The sequence b, c, f, e, b is a cycle of length 4.
• The path a, b, e, d, a, b of length 5 is not a simple path because
edge (a,b) is present twice.

16
Connected Graph
• Definition 2. An undirected graph is said to be connected if it can
always find a path between any two of its vertices.
• In the case that the graph G=<V, E> is not connected, we can decompose
G into a number of connected subgraphs that have no common vertex.
– Each such subgraph is called a connected component of G.
– Thus, a graph is connected if and only if its number of connected
components is 1.
• For an undirected graph, if there exists a vertex u  V such that u has a
path to all the remaining vertices of the graph, we can conclude that the
graph is connected.

17
Ex
• The number of connected components of G is 3.

18
Bridge, cut vertex
(cạnh cầu, đỉnh trụ (khớp)
• Definition 3.
– Edge e  E is said to be bridged if removing e increases the connected component
of the graph.
– The vertex u  V is called a cylindrical vertex if removing u along with the edges
connected to u increases the connected component of the graph.
• Ex: edge (5,10 ) is bridge, vertex 6 is cut vertex.

19
Directed graph
Semi-degree of the vertex
• Definition 1. If e=(u,v) is an arc of a directed graph G, then we
say that the two vertices u and v are adjacent , and say the arc
(u, v) connects the vertex u to the vertex v, or say the arc (u, v)
This goes out of vertex u and into vertex v.
– The vertex u is called the first vertex, and the vertex v is called the last
vertex of the arc (u,v).
• Definition 2.
– We call the semi-out of v on a directed graph the number of arcs of
the graph going out of v and denoted by deg+ (v).
– We call the semi-degree of entry of vertex v on a directed graph the
number of arcs of the entering graph v and denoted by deg- (v).

21
Ex

22
Sum of semi-degrees of vertices
• Theorem 1. Suppose G = <V, E> is a directed graph. Then :

• Note :
• The undirected graph obtained by ignoring the direction on the arcs is
called the undirected graph corresponding to the given directed graph.

23
Path, cycle
• Definition 1. The path of length n from vertex u to vertex v in a directed graph
G=<V,E> is the sequence x0 , x1 , . . ., xn , where, n is a positive integer, u = x0 , v = xn ,
(xi , xi+1 )  E.
• The path above can be represented as a sequence of arcs : (x0 , x1 ), (x1 , x2 ), . . ., (xn-1,
xn ).
• The vertex u is called the first vertex and the vertex v is called the last vertex of the
path.
• A path whose first vertex coincides with its last vertex (u=v) is called a cycle. A path
or cycle is said to be simple if no two edges repeat.

24
Graphs are strongly connected and weakly
connected
• Definition 2. A directed graph G=<V,E> is said to be strongly connected if
between any two vertices u  V, v  V there is a path from u to v.
• Definition 3. A directed graph G=<V,E> is said to be weakly connected if
its corresponding undirected graph is connected.

Graph G1 is strongly connected, graph G2 is weakly connected.

25
Dimensionable
(Định chiều được)
• Definition 4. An undirected graph G=<V,E> is said to be dimensional if we can
transform the edges in G into corresponding arcs to obtain a strongly connected
directed graph .
• Theorem 1. An undirected graph G= < V, E > is dimensional if and only if its edges
are not bridge.

26
Some special types of graphs
Complete Graph
• A complete graph of n vertices, denoted by Kn , is a simple undirected
graph in which there is a joining edge between any two vertices.

28
Compensation graph
(Đồ thị bù)
• G' is said to be a complement of G if its vertices are vertices
of G and two vertices of G' are adjacent if and only if they are
not adjacent on G.

1 2 1 2

G G'
3 3
4 4

29
Cycle graph
• The cycle graph C n (n  3) has edges (1,2),(2,3),..,(n-1,n), (n,1).

✓Vertices with the same degree ( 2 )


✓There n edges

30
Wheel Graph
• Wheel graph Wn is obtained by adding a vertex joining all
vertices of C n .

31
(Two-sided) Bipartite graph
• A graph G = <V,E> is said to be Bipartite if its vertex set V can
be partitioned into two sets X and Y such that each edge of
the graph has only the form (x, y), where x  X and y  Y ( X 
Y=V and X  Y=∅ ).
• Example : Graph K 5.4 .

32
Complete bipartite graph
• Bipartite graph G=(X  Y, E) with |X|= m,|Y| = n is called a
complete bipartite graph, denoted by K m,n if each vertex in set
X is connected to all vertices in set Y and vice versa.
• Example : Graph K 2,3 ; K 3 , 3 ; K 3.5 .

33
Algorithm to check connected graph is Bipartite

• Theorem: G is a Bipartite graph <=> G has no cycle


which has odd length.
• Algorithm :
1) Let v be any vertex of the graph. Set X={v}
2) Find Y is the set of adjacent vertices of the vertices in X.
a) If X  Y  then the graph is not bipartite, terminated.
b) Otherwise, go to (3) .
3) Find T is the set of adjacent vertices of the vertices in Y.
a) If T  Y  then the graph is not bipartite, terminated.
b) If T=X then the graph is bipartite, terminated. Otherwise, X=T and
repeat ( 1 ) .

34
Example of Bipartite graph
• This graph is not bipartite because it contains cycles of odd
length (=3).

• This graph is not bipartite because it contains cycles of odd


length (=3 ).

35
Example of Bipartite graph (cont'd)
• This graph is two-sided because it does not contain
cycles of odd length .

36
Cube graph
• The cube graph Qn is a graph with vertices representing 2n
binary strings of length n bits.
– Its two vertices are contiguous if the two corresponding binary strings
differ by only 1 bit .
• For example: Q n with n = 0, 1, 2, 3.

37
Planar graph
• A graph is said to be planar if it can be drawn on a plane such
that its edges do not intersect .
• Example :

• Planar graphs have many important


applications in printed circuit
technology.
• The planar representation of the graph
will divide the plane into regions (using
Euler's formula), including the
unbounded domain. 38
Planar Graph: Euler Formula

• G is a connected planar graph, G has n vertices, m edges, r is


the number of regions of the plane divided by the plane
representation of G. We have: r = m-n + 2
• For example: m=11, n=7 number of domains r= m-n+2 = 6

39
Planar graph recognition
• Corollary 1: If G is a simple planar graph connected with n vertices
and m edges, then m≤3n–6 .
• Corollary 2: If G is a simple planar connected graph with n vertices,
m edges and no cycles of length 3, then m≤2n–4 .
• Corollary 3: In a single connected planar graph, there is always at
least one vertex of degree < 5 .
• Example :
– Consider the graph K 3.3 with n = 6; m = 9. We have K 3.3 which is a simple
connected graph without a cycle of length 3 but does not satisfy the properties
of the planar graph in Corollary 2 (m = 9 >2n – 4 = 8). So K 3.3 is not a planar
graph .
– Consider the same with K 5 with n = 5; m = 10. We have K 5 which is a simple
connected graph but does not satisfy the properties of the planar graph in
Corollary 1 (m = 10 > 3n – 6 = 9). So K 5 is not a planar graph .

40
Planar graph – How to?
• Sign 1: If graph G contains a subgraph that is not planar, then G is not
planar.
• Sign 2: Graph G does not satisfy the conclusion of Corollary 1, Corollary 2
is a non-planar graph.
• Sign 3 (Kuratowski's Theorem): Graph G is not planar if and only if G
contains a subgraph congruent (đồng dạng) with K 3.3 or K 5 .
• Definition: We say the graph G' is generated from G by division by edge
(x, y) if G' is obtained from G by removing edge (x, y) and adding vertex z
and two edges (x) , z), (z, y).
– Graphs G1 and G2 are said to be congruent if they are derived from the same graph G
by a series of edge divisions.

41
Planar graph – How to?
• Note: Two graphs K5 and K3,3 are the simplest non-planar
graphs with the following properties:
– If we delete a vertex or an edge of the two graphs above, we will get a
planar graph.
– Graph K 5 is a non-planar graph with the fewest vertices.
– Graph K 3.3 is a non-planar graph with the fewest edges.

42
Planar graph – How to?
• Example : Check if graph G is planar?
– Use Kuratowski's theorem.

43
Subgraph and eigengraph (own graph)
• Assume G = (V, E) is a graph.
– Graph G' = (V', E') is a subgraph of G if V'⊆V and E'⊆E.
– Graph G” = (V, E”) with E” ⊆ E is the eigengraph of the
graph G.
• Note:
– Each subset of vertices V ' of a graph G that corresponds
uniquely to a subgraph.
• To define a subgraph, we only need to state the vertex set of it.
– An eigengraph is a graph that keeps the set of vertices
intact and removes them one edge number.

44
Subgraphs and eigengraphs: Example

45
Isomorphism
(Đẳng hình)
• Two graphs G1= (V1, E1) and G2= (V2, E2) are call is isomorphism if there exists a
one-to-one and onto function S on the sets vertices preserve (bảo toàn) edges:
∀x, y ∈ V1: (x, y) ∈ E1 ⇔ (S(x), S(y)) ∈ E2.
• Two isomorphic graphs differing only in name of the the vertices and expressions to
act by drawing.
– Therefore, we do not distinguish two graphs isomorphic to each other.
• Two isomorphic graphs will have the same number of vertices, the same number of
vertices of degree k, the same number of edges, and the same number of connected
components .

46
Example of isomorphism
• The following two graphs are isomorphic with
bijective function (song ánh):
S(a i ) = x i , i = 1, 2, 3, 4.

47
Graph coloring
• T color the graph so that two adjacent vertices have
different colors and use as few colors as possible.
• Algorithm:
1) Sort the list of vertices in descending order .
2) Let m be the number of colors to use, initially m=0;
3) While there are uncolored vertices {
a) m=m+1;
b) Fill m the first uncolored vertex in the list.
c) Color m for uncolored vertices in the list and not adjacent to
vertices of color m.
}

48
Graph coloring: Example
• Given a single undirected graph with 7 vertices, the adjacency matrix
form is as follows:

• Present the results at each step when applying the coloring algorithm.
49
Exercise
Exercise 1
• Determine the degree of each vertex.
• Connected? Exist Path? Cycle?
• Bridge? Cut vertex?
• Dimensionable?

51
Exercise 2
• Determine the input semi-order deg- and the output semi-
degree deg + of each vertex.
• Weakly connected? Strongly connected?
• Exist Path? Cycle?

52
Exercise 3
• Draw an undirected graph G=(V,E) given by:
V={a,b,c,d,e,f,g}
and
E = {( e , g ),( b , f ),( d , c ),( d , f ),( c , f ), ( a , f ),(
e , d )}

53
Exercise 4
• Let f as follows:
f(A)=1, f(B)=2, f(C)=3, f(D)=4, f(E)=5, f(F)=6.
• Check if the following two graphs are isomorphic or not?

54
Exercise 5
• Check if the following two graphs are isomorphic or
not?

57
Exercise 6
• For each of the following graphs, indicate whether
it is a planar graph? If yes, show how to draw.

12 cnh , 8 nh chu k = 3 , 5 nh ,9 cnh


8*3-6=18 5*3-6 = 9

59
Exercise 7
• There are 7 subjects, the following pairs of exams have the same students:
(1,2);(1,3);(1,4);(1,7);(2,3);(2,4);(2,5);(2,7),
(3,4);(3,7);(4,5);(4,6);(5,7);(6,7)
• Use the coloring algorithm to find the minimum number of sessions that need to be
held.

60
Exercise 8
• There are 7 TV stations spaced apart as shown in the table below. What is
the minimum number of different channels required to broadcast. Two
stations cannot use the same channel if they are not more than 15 km apart.

61

You might also like