graph theory - lecture 1 (of 2) -...

43
MAT 1348b - Discrete Maths for Computing Graph Theory - Lecture 1 (of 2) Supartha Podder April 04, 2018

Upload: vutu

Post on 19-May-2018

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

MAT 1348b - Discrete Maths for Computing

Graph Theory - Lecture 1 (of 2)

Supartha Podder

April 04, 2018

Page 2: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory

Click here for a movable graph

Page 3: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory

Page 4: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory

Page 5: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory

Page 6: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory

Page 7: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory

a

bc

de

f gG

e1 e2

e3e4

e5e6

e7

e8

Definition (Graph)

A graph G is an ordered pair (V ,E ), where

V = V (G ) is a non-empty set of vertices – The vertex set of G ;

E = E (G ) is a set of edges the edge set of G ; and the two sets arerelated through a function

fG : E → {{u, v} : u, v ∈ V }

called the incidence function, assigning to each edge the unorderedpair of its end-points. 1/21

Page 8: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Example

za

bc

de

f gG

e1 e2

e3e4

e5e6

e7

e8

The drawing above represents a graph with vertex setV = {a, b, c , d , e, f , g}, edge set E = {e1, e2, · · · , e8}, and incidencefunction defined by

f (e1) = {a, b} f (e2) = {b, c}f (e3) = {b, d} f (e4) = {b, e}f (e5) = {c , e} f (e6) = {d , f }f (e7) = {e, f } f (e8) = {c , g}

2/21

Page 9: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Loop and Parallel Edges

Definition

An edge e in a graph G is called a

loop if fG (e) = {u} for some vertex u ∈ V (G ) (that is, if itsendpoints coincide)

link if fG (e) = {u, v}for distinct vertices u, v ∈ V (G ).

Distinct edges e1 and e2 in a graph G are called parallel or multipleif fG (e1) = fG (e2),that is, if they have the same endpoints. 3/21

Page 10: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Loop and Parallel Edges

In this example, edges e1 ande7 are loops,and all other edges are links.Edges e3, e4, and e5 are pairwise parallel.

Definition (Simple Graph)

A simple graph is a graph without loops and without multiple edges.

4/21

Page 11: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Loop and Parallel Edges

In this example, edges e1 ande7 are loops,and all other edges are links.Edges e3, e4, and e5 are pairwise parallel.

Definition (Simple Graph)

A simple graph is a graph without loops and without multiple edges.

4/21

Page 12: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Directed Graph

Definition

A directed graph (or digraph) D is an ordered pair (V ,A), where

V = V (D) is a non-empty set of vertices – the vertex set of D;

A = A(D) is a set of arcs or directed edges the arc set of D; and

the two sets are related via an incidence function fD :→ V × V ,assigning to each arc the ordered pair of its endpoints.

5/21

Page 13: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Directed Graph Example

We have a digraph with vertex set V = {v1, v2, v3, v4} and arc setA = {a1, a2, ..., a9}. The incidence function returns

fD(a1) = {v1, v1} fD(a2) = {v1, v2}fD(a3) = {v3, v2} fD(a4) = {v2, v3}fD(a5) = {v2, v3} fD(a6) = {v2, v4}fD(a7) = {v3, v3} fD(a8) = {v3, v4}fD(a9) = {v4, v3}

6/21

Page 14: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Directed Graph Example

If a ∈ A(D) and u, v ∈ V (D) are such that fD(a) = (u, v), then u is calledthe initial and v is called the terminal vertex of the arc a.

7/21

Page 15: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Terminology

Page 16: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Graph Terminology

Adjacent: Let G = (V ,E ) be a graph. Vertices u, v ∈ V are calledadjacent or neighbours in G if uv is an edge of G .

Incident An edge uv is said to be incident with each of its end pointsu and v .

Degree The degree of a vertex u ∈ V , denoted by degG (u), is thenumber of edges of G incident with vertex u, each loop countingtwice.

– A vertex of degree 0 is called isolated, and a vertex of degree 1 iscalled pendant (or a leaf in the context of trees).

8/21

Page 17: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Graph Terminology

Adjacent: Let G = (V ,E ) be a graph. Vertices u, v ∈ V are calledadjacent or neighbours in G if uv is an edge of G .

Incident An edge uv is said to be incident with each of its end pointsu and v .

Degree The degree of a vertex u ∈ V , denoted by degG (u), is thenumber of edges of G incident with vertex u, each loop countingtwice.

– A vertex of degree 0 is called isolated, and a vertex of degree 1 iscalled pendant (or a leaf in the context of trees).

8/21

Page 18: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Graph Terminology

Adjacent: Let G = (V ,E ) be a graph. Vertices u, v ∈ V are calledadjacent or neighbours in G if uv is an edge of G .

Incident An edge uv is said to be incident with each of its end pointsu and v .

Degree The degree of a vertex u ∈ V , denoted by degG (u), is thenumber of edges of G incident with vertex u, each loop countingtwice.

– A vertex of degree 0 is called isolated, and a vertex of degree 1 iscalled pendant (or a leaf in the context of trees).

8/21

Page 19: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Graph Terminology

Adjacent: Let G = (V ,E ) be a graph. Vertices u, v ∈ V are calledadjacent or neighbours in G if uv is an edge of G .

Incident An edge uv is said to be incident with each of its end pointsu and v .

Degree The degree of a vertex u ∈ V , denoted by degG (u), is thenumber of edges of G incident with vertex u, each loop countingtwice.

– A vertex of degree 0 is called isolated, and a vertex of degree 1 iscalled pendant (or a leaf in the context of trees).

8/21

Page 20: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Handshaking Theorem

9/21

Page 21: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Handshaking Theorem

Theorem (The Handshaking Theorem)

In any graph G = (V ,E ), we have∑u∈V

degG (u) = 2|E |

Proof.

In the sum∑

u∈V degG (u):

each loop incident with vertex u counts 2 towards degG (u), and

each link uv counts 1 towards degG (u) and 1 towards degG (v).

Hence each edge is counted twice in∑

u∈V degG (u), and the result follows.

10/21

Page 22: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Handshaking Theorem

Theorem (The Handshaking Theorem)

In any graph G = (V ,E ), we have∑u∈V

degG (u) = 2|E |

Proof.

In the sum∑

u∈V degG (u):

each loop incident with vertex u counts 2 towards degG (u), and

each link uv counts 1 towards degG (u) and 1 towards degG (v).

Hence each edge is counted twice in∑

u∈V degG (u), and the result follows.

10/21

Page 23: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Handshaking Theorem

Theorem (The Handshaking Theorem)

In any graph G = (V ,E ), we have∑u∈V

degG (u) = 2|E |

Corollary

Every graph has an even number of vertices of odd degree.

Proof.

Let G = (V ,E ) be a graph, V1 the subset of V containing all vertices of odddegree,and V2 = V − V1. Then, by the Handshaking Theorem,

2|E | =∑u∈V

degG (u) =∑u∈V1

degG (u) +∑u∈V2

degG (u)

∑u∈V1

degG (u) = 2|E | −∑u∈V2

degG (u)

11/21

Page 24: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Handshaking Theorem

Theorem (The Handshaking Theorem)

In any graph G = (V ,E ), we have∑u∈V

degG (u) = 2|E |

Corollary

Every graph has an even number of vertices of odd degree.

Proof.

Let G = (V ,E ) be a graph, V1 the subset of V containing all vertices of odddegree,and V2 = V − V1. Then, by the Handshaking Theorem,

2|E | =∑u∈V

degG (u) =∑u∈V1

degG (u) +∑u∈V2

degG (u)

∑u∈V1

degG (u) = 2|E | −∑u∈V2

degG (u)

11/21

Page 25: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Some Useful Graphs

Page 26: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Complete Graph

Complete Graph

A complete graph Kn (for n ≥ 1) is a simple graph with n vertices inwhich every pair of distinct vertices are adjacent. More formally

V (Kn) = {u1, u2, · · · , un}

E (Kn) = {xy : x , y ∈ V , x 6= y}

12/21

Page 27: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Complete Graph

Complete Graph

A complete graph Kn (for n ≥ 1) is a simple graph with n vertices inwhich every pair of distinct vertices are adjacent. More formally

V (Kn) = {u1, u2, · · · , un}

E (Kn) = {xy : x , y ∈ V , x 6= y}

12/21

Page 28: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Complete Bi-partite Graph

Complete Bi-partite Graph

A complete bipartite graph Km,n (for m, n ≥ 1) is a simple graph withm + n vertices. The vertex set partitions into sets X and Y of cardinalitiesm and n, and each pair of vertices from distinct parts are adjacent. Thatis:

V (Km,n) = {x1, x2, · · · , xm} ∪ {y1, y2, · · · , yn}

E (Km,n) = {xiyj : xi ∈ X , yj ∈ Y }

13/21

Page 29: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Complete Bi-partite Graph

Complete Bi-partite Graph

A complete bipartite graph Km,n (for m, n ≥ 1) is a simple graph withm + n vertices. The vertex set partitions into sets X and Y of cardinalitiesm and n, and each pair of vertices from distinct parts are adjacent. Thatis:

V (Km,n) = {x1, x2, · · · , xm} ∪ {y1, y2, · · · , yn}

E (Km,n) = {xiyj : xi ∈ X , yj ∈ Y }13/21

Page 30: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Bipartite Graph

Bipartite Graph

A bipartite graph Km,n (for m, n ≥ 1) is a simple graph with m + nvertices. The vertex set partitions into sets X and Y of cardinalities m andn. And edges are only of the form xy , where x ∈ X , y ∈ Y :

V (Km,n) = {x1, x2, · · · , xm} ∪ {y1, y2, · · · , yn}

E (Km,n) ⊆ {xiyj : xi ∈ X , yj ∈ Y }

14/21

Page 31: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Bipartite Graph

Bipartite Graph

A bipartite graph Km,n (for m, n ≥ 1) is a simple graph with m + nvertices. The vertex set partitions into sets X and Y of cardinalities m andn. And edges are only of the form xy , where x ∈ X , y ∈ Y :

V (Km,n) = {x1, x2, · · · , xm} ∪ {y1, y2, · · · , yn}

E (Km,n) ⊆ {xiyj : xi ∈ X , yj ∈ Y }

14/21

Page 32: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Cycle

Cycle

A cycle Cn (of length n ≥ 1) is a graph with n vertices that are linked in acircular way, creating n edges. That is,

V (Cn) = {u1, u2, · · · , un}

E (Cn) = {u1u2, u2u3, u3u4, · · · , un−1un, unu1}

Note that any cycle Cn for n ≥ 3 is a simple graph, while for n = 2, theedge set E (Cn) consists of a pair of parallel edges.

15/21

Page 33: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Cycle

Cycle

A cycle Cn (of length n ≥ 1) is a graph with n vertices that are linked in acircular way, creating n edges. That is,

V (Cn) = {u1, u2, · · · , un}

E (Cn) = {u1u2, u2u3, u3u4, · · · , un−1un, unu1}

Note that any cycle Cn for n ≥ 3 is a simple graph, while for n = 2, theedge set E (Cn) consists of a pair of parallel edges.

15/21

Page 34: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Cycle

Cycle

A cycle Cn (of length n ≥ 1) is a graph with n vertices that are linked in acircular way, creating n edges. That is,

V (Cn) = {u1, u2, · · · , un}

E (Cn) = {u1u2, u2u3, u3u4, · · · , un−1un, unu1}

Note that any cycle Cn for n ≥ 3 is a simple graph, while for n = 2, theedge set E (Cn) consists of a pair of parallel edges.

15/21

Page 35: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Path

Path

A path Pn (of length n ≥ 0) is a graph with n + 1 vertices that are linkedin a linear way. More precisely,

V (Pn) = {u1, u2, · · · , un}

E (Pn) = {u1u2, u2u3, u3u4, · · · , un−1un}

16/21

Page 36: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Path

Path

A path Pn (of length n ≥ 0) is a graph with n + 1 vertices that are linkedin a linear way. More precisely,

V (Pn) = {u1, u2, · · · , un}

E (Pn) = {u1u2, u2u3, u3u4, · · · , un−1un}

16/21

Page 37: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Subgraph

a

b c

d e

f gG H

h

i j

k

Subgraph

Let G and H be simple graphs. We say that H is a subgraph of G ifV (H) ⊆ V (G ) and E (H) ⊆ E (G ).

But is it induced subgraph? What is that by the way?

17/21

Page 38: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Subgraph

a

b c

d e

f gG H

h

i j

k

Subgraph

Let G and H be simple graphs. We say that H is a subgraph of G ifV (H) ⊆ V (G ) and E (H) ⊆ E (G ).

But is it induced subgraph? What is that by the way?

17/21

Page 39: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Matrix Representation of Graphs

Page 40: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Incident Matrix Representation

Incident Matrix Representation

Let G be a graph with V (G ) = {u1, u2, · · · , un},E (G ) = {e1, e2, · · · , em},and incidence function fG . We define:

the incidence matrix of G : an n ×m matrix M = [mij ] such that

mij =

2, if fG (ej) = {vj}1, if fG (ej) = {ui , uk} for some k 6= i

0 otherwise.

(1)

18/21

Page 41: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Adjacency Matrix Representation

Adjacency Matrix Representation

Let G be a graph with V (G ) = {u1, u2, · · · , un},E (G ) = {e1, e2, · · · , em},and incidence function fG . We define:

the adjacency matrix of G : an n × n matrix A = [aij ] such that

aij = |{ek : fG (ek) = {ui , uj}}|

= number of edges with end points ui and uj .

19/21

Page 42: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Graph Theory - Adjacency Matrix Representation

20/21

Page 43: Graph Theory - Lecture 1 (of 2) - mysite.science.uottawa.camysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides.pdf · MAT 1348b - Discrete Maths for Computing Graph Theory

Thank you for your attention!!

Lecture 2 (of 2) on April 09, 2018.

21/21