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

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

Upload: vanthuy

Post on 19-May-2018

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

MAT 1348b - Discrete Maths for Computing

Graph Theory - Lecture 2 (of 2)

Supartha Podder

April 09, 2018

Page 2: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Theory

Click here for a movable graph

Page 3: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Theory

a

bc

de

f gG

e1 e2

e3e4

e5e6

e7

e8

1/31

Page 4: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Theory - Loop and Parallel Edges

2/31

Page 5: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Some Useful Graphs

Page 6: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

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}

3/31

Page 7: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Theory - Cycle

Cycle

A cycle Cn (of length n ≥ 0) is a graph with n vertices that are linked in alinear way. More precisely,

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

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

4/31

Page 8: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

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 }5/31

Page 9: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

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}

6/31

Page 10: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Theory - Complete Bipartite 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 }7/31

Page 11: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Bipartite Graph, 2-Coloring and No Odd-length Cycle

Theorem

The following are equivalent:

1 G is bipartite.

2 G admits a proper 2-vertex-colouring; that is, the vertices of G canbe coloured with 2 colours (say, red and blue) so that the endpointsof each edge receive distinct colours.

3 G has no subgraph that is a cycle of odd length.

1 2

3 4

5 6

78G

1

8/31

Page 12: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Bipartite Graph, 2-Coloring and No Odd-length Cycle

Theorem

The following are equivalent:

1 G is bipartite.

2 G admits a proper 2-vertex-colouring; that is, the vertices of G canbe coloured with 2 colours (say, red and blue) so that the endpointsof each edge receive distinct colours.

3 G has no subgraph that is a cycle of odd length.

1 2

3 4

5 6

78G

1

8/31

Page 13: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Bipartite Graph, 2-Coloring and No Odd-length Cycle

Theorem

The following are equivalent:

1 G is bipartite.

2 G admits a proper 2-vertex-colouring; that is, the vertices of G canbe coloured with 2 colours (say, red and blue) so that the endpointsof each edge receive distinct colours.

3 G has no subgraph that is a cycle of odd length.

1 2

3 4

5 6

78G

1

8/31

Page 14: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Bipartite Graph, 2-Coloring and No Odd-length Cycle

Proof.

(1)→ (2) :Assume the graph G is bipartite with bipartition {X ,Y }. Colour thevertices in X red and the vertices in Y blue.Since each edge has one endpoint in X and the other in Y , theendpoints of each edge receive distinct colours.

(2)→ (1) :Assume that G admits a proper 2-vertex-colouring.Let X be the set of all vertices in V (G ) coloured red, and Y be theset of all vertices in V (G ) coloured blue.Since the endpoints of each edge receive distinct colours, each edgemust have one endpoint in X and the other in Y .

9/31

Page 15: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

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 ).

10/31

Page 16: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

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 ).

10/31

Page 17: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Matrix Representation of Graphs

Page 18: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

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)

11/31

Page 19: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

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 .

12/31

Page 20: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Theory - Adjacency Matrix Representation

13/31

Page 21: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism

Graph Isomorphism Problem is one of the most interesting problems incomputer science.

a

b

c

d

g

h

i

j

1 2

3 4

5 6

78G H

a

b

c

d

g

h

i

j

1 2

3 4

5 6

78

f (a) = 5 f (b) = 2

f (c) = 3 f (d) = 7

f (g) = 1 f (h) = 6

f (i) = 8 f (j) = 4

An Isomorphismbetween G and H

Click here for an animated example

14/31

Page 22: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism

Graph Isomorphism Problem is one of the most interesting problems incomputer science.

a

b

c

d

g

h

i

j

1 2

3 4

5 6

78G H

a

b

c

d

g

h

i

j

1 2

3 4

5 6

78

f (a) = 5 f (b) = 2

f (c) = 3 f (d) = 7

f (g) = 1 f (h) = 6

f (i) = 8 f (j) = 4

An Isomorphismbetween G and H

Click here for an animated example

14/31

Page 23: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism

Graph Isomorphism Problem is one of the most interesting problems incomputer science.

a

b

c

d

g

h

i

j

1 2

3 4

5 6

78G H

a

b

c

d

g

h

i

j

1 2

3 4

5 6

78

f (a) = 5 f (b) = 2

f (c) = 3 f (d) = 7

f (g) = 1 f (h) = 6

f (i) = 8 f (j) = 4

An Isomorphismbetween G and H

Click here for an animated example

14/31

Page 24: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism

Graph Isomorphism Problem is one of the most interesting problems incomputer science.

a

b

c

d

g

h

i

j

1 2

3 4

5 6

78G H

a

b

c

d

g

h

i

j

1 2

3 4

5 6

78

f (a) = 5 f (b) = 2

f (c) = 3 f (d) = 7

f (g) = 1 f (h) = 6

f (i) = 8 f (j) = 4

An Isomorphismbetween G and H

Click here for an animated example

14/31

Page 25: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism

Are these two graph isomorphic?

Definition (Graph Isomorphism)

Let G and H be simple graphs. An isomorphism from G to H is abijection ϕ : V (G )→ V (H) such that

u ∼G v ⇔ ϕ(u) ∼H ϕ(v)

for all u, v ∈ V (G ). Graphs G and H are called isomorphic (denotedG ∼= H) if there exists an isomorphism from G to H.

15/31

Page 26: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism

Definition (Graph Invariant)

A graph invariant is a graph property or parameter that is preserved underisomorphisms; that is, isomorphic graphs must agree on this property orparameter. Many graph properties are invariants; for example:

Number of vertices

Number of edges

Degree Sequence (all the degrees of the vertices of the graph insorted order)

Being bipartite

Containing specific subgraph etc.

16/31

Page 27: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism

Observation

To prove that graphs G and H are isomorphic, we must find anisomorphism from G to H.

To prove that graphs G and H are not isomorphic, it suffices to findan invariant in which G and H differ.

17/31

Page 28: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism -Example 1

Are these two graph isomorphic?

Solution:

No. They have the same degree sequence. But these two graphs are notisomorphic. H has a subgraph isomorphic to C3, while G does not (it is, infact, bipartite and isomorphic to K3,3).

18/31

Page 29: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism -Example 1

Are these two graph isomorphic?

Solution:

No. They have the same degree sequence. But these two graphs are notisomorphic. H has a subgraph isomorphic to C3, while G does not (it is, infact, bipartite and isomorphic to K3,3).

18/31

Page 30: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism -Example 2

Are these two graph isomorphic?

Solution:

Yes, these two graphs are isomorphic. An isomorphism ϕ : (G )→ V (H) isgiven by

ϕ(1) = a ϕ(2) = dϕ(3) = b ϕ(4) = eϕ(5) = c ϕ(6) = f

19/31

Page 31: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism -Example 2

Are these two graph isomorphic?

Solution:

Yes, these two graphs are isomorphic. An isomorphism ϕ : (G )→ V (H) isgiven by

ϕ(1) = a ϕ(2) = dϕ(3) = b ϕ(4) = eϕ(5) = c ϕ(6) = f

19/31

Page 32: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism -Example 3

Are these two graph isomorphic?

Solution:

No, these two graphs are not isomorphic. They have the same degreesequence, however, graph H contains no pair of adjacent vertices of degree3, while G does.

20/31

Page 33: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Graph Isomorphism -Example 3

Are these two graph isomorphic?

Solution:

No, these two graphs are not isomorphic. They have the same degreesequence, however, graph H contains no pair of adjacent vertices of degree3, while G does.

20/31

Page 34: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycle

Page 35: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

Walk Let G = (V ,E ) be a graph with the incidence function fG . Letx , y ∈ V and k ∈ N. An (x , y)-walk of length k in G is an alternatingsequence of vertices and edges.

A (v1, v3)-walk of length 4

W = v1e2v2e6v4e8v3e7v3

21/31

Page 36: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

Walk Let G = (V ,E ) be a graph with the incidence function fG . Letx , y ∈ V and k ∈ N. An (x , y)-walk of length k in G is an alternatingsequence of vertices and edges.

A (v1, v3)-walk of length 4

W = v1e2v2e6v4e8v3e7v321/31

Page 37: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 1a2h6n5f 1a2b3is a (1,3)-walk of length 6 that is not a trail.

W = 1e4d4c3is a (1,3)-trail of length 3 that is not a path.

W = 1f 5m8k3is a (1,3)-path of length 3.

22/31

Page 38: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 1a2h6n5f 1a2b3is a (1,3)-walk of length 6 that is not a trail.

W = 1e4d4c3is a (1,3)-trail of length 3 that is not a path.

W = 1f 5m8k3is a (1,3)-path of length 3.

22/31

Page 39: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 1a2h6n5f 1a2b3

is a (1,3)-walk of length 6 that is not a trail.

W = 1e4d4c3is a (1,3)-trail of length 3 that is not a path.

W = 1f 5m8k3is a (1,3)-path of length 3.

22/31

Page 40: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 1a2h6n5f 1a2b3is a (1,3)-walk of length 6 that is not a trail.

W = 1e4d4c3is a (1,3)-trail of length 3 that is not a path.

W = 1f 5m8k3is a (1,3)-path of length 3.

22/31

Page 41: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 1a2h6n5f 1a2b3is a (1,3)-walk of length 6 that is not a trail.

W = 1e4d4c3

is a (1,3)-trail of length 3 that is not a path.

W = 1f 5m8k3is a (1,3)-path of length 3.

22/31

Page 42: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 1a2h6n5f 1a2b3is a (1,3)-walk of length 6 that is not a trail.

W = 1e4d4c3is a (1,3)-trail of length 3 that is not a path.

W = 1f 5m8k3is a (1,3)-path of length 3.

22/31

Page 43: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 1a2h6n5f 1a2b3is a (1,3)-walk of length 6 that is not a trail.

W = 1e4d4c3is a (1,3)-trail of length 3 that is not a path.

W = 1f 5m8k3

is a (1,3)-path of length 3.

22/31

Page 44: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 1a2h6n5f 1a2b3is a (1,3)-walk of length 6 that is not a trail.

W = 1e4d4c3is a (1,3)-trail of length 3 that is not a path.

W = 1f 5m8k3is a (1,3)-path of length 3.

22/31

Page 45: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 2b3j7i2h6o7i2

is a closed walk of length6 that contains vertex 2 and is not a trail:.

W = 4d4l8k3c4 is a closed trail of length4 that contains vertex 4 and is not a cycle.

W = 2b3j7o6h2 is a cycle of length 4containing vertex 2.

23/31

Page 46: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 2b3j7i2h6o7i2 is a closed walk of length6 that contains vertex 2 and is not a trail:.

W = 4d4l8k3c4 is a closed trail of length4 that contains vertex 4 and is not a cycle.

W = 2b3j7o6h2 is a cycle of length 4containing vertex 2.

23/31

Page 47: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 2b3j7i2h6o7i2 is a closed walk of length6 that contains vertex 2 and is not a trail:.

W = 4d4l8k3c4

is a closed trail of length4 that contains vertex 4 and is not a cycle.

W = 2b3j7o6h2 is a cycle of length 4containing vertex 2.

23/31

Page 48: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 2b3j7i2h6o7i2 is a closed walk of length6 that contains vertex 2 and is not a trail:.

W = 4d4l8k3c4 is a closed trail of length4 that contains vertex 4 and is not a cycle.

W = 2b3j7o6h2 is a cycle of length 4containing vertex 2.

23/31

Page 49: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 2b3j7i2h6o7i2 is a closed walk of length6 that contains vertex 2 and is not a trail:.

W = 4d4l8k3c4 is a closed trail of length4 that contains vertex 4 and is not a cycle.

W = 2b3j7o6h2

is a cycle of length 4containing vertex 2.

23/31

Page 50: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Walks, Trails, Paths, Cycles

Definition

A walk W = v0e1v1e2v2 · · · vk1ekvk is called

closed if v0 = vk , and open otherwise;

a trail if its edges are pairwise distinct;

a path if its vertices are pairwise distinct; and

a cycle if v0 = vk while its internal vertices v1, · · · , vk are pairwisedistinct.

W = 2b3j7i2h6o7i2 is a closed walk of length6 that contains vertex 2 and is not a trail:.

W = 4d4l8k3c4 is a closed trail of length4 that contains vertex 4 and is not a cycle.

W = 2b3j7o6h2 is a cycle of length 4containing vertex 2.

23/31

Page 51: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Trees and Forests

Page 52: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Trees and Forests

Page 53: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Warm up: Connected Graph

Connected Graph

A graph G = (V ,E ) is called connected if for any x , y ∈ V there exists an(x , y)-path (or equivalently, (x , y)-walk) in G . A graph that is notconnected is called disconnected.

24/31

Page 54: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Trees

Tree and Forest

A graph without cycles is called acyclic or a forest. A tree is a connectedacyclic graph ,that is, a connected forest.

25/31

Page 55: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Trees

Theorem 1

Let G be a graph. Then G is a tree if and only if for any two verticesu, v ∈ V (G ), there exists a unique (u, v)-path in G .

Theorem 2 and 3

Every tree with at least 2 vertices has at least 2 vertices of degree 1(called leaves).

Any tree with n vertices has exactly n − 1 edges.26/31

Page 56: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Rooted Trees

Rooted Tree

A tree with a vertex designated as the root is called a rooted tree.

27/31

Page 57: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Rooted Trees

Similar terminologies for rooted trees?

28/31

Page 58: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Rooted Trees

Terminology for rooted trees:

Let T = (V ,E ) be a rooted tree with root r and u, v ∈ V .

If u lies on the unique (v , r)-path, then u is called anancestor of v ,and v is called a descendant to u.

If u lies on the unique (v , r)-path and uv has an edge, then u is calledthe parent of v , and v is called a child of u.

If u and v have the same parent, then they are called siblings.

If vertex u has a child, then it is called an internal vertex; if it hasno children, thenit is called a leaf.

29/31

Page 59: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Rooted m-ary Trees

A Rooted m-ary Tree:

an m-ary tree if every internal vertex has at most m children; and

a full m-ary tree if every internal vertex has exactly m children.

A Binary is a 2-ary tree.A Ternary is a 3-ary tree.

30/31

Page 60: Graph Theory - Lecture 2 (of 2) - …mysite.science.uottawa.ca/spodder/courses/2018/MAT1348B/slides2.pdf · Graph Theory - Path Path A path P n (of length n 0) is a graph with n +

Thank you for your attention!!

31/31