bct 2083 discrete structure and applications chapter 3 graphs siti zanariah satari fist/fskkp ump...

117
BCT 2083 DISCRETE STRUCTURE AND BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS APPLICATIONS CHAPTER 3 CHAPTER 3 GRAPHS GRAPHS SITI ZANARIAH SATARI SITI ZANARIAH SATARI FIST/FSKKP UMP I0910 FIST/FSKKP UMP I0910

Upload: helena-townsend

Post on 18-Jan-2018

224 views

Category:

Documents


0 download

DESCRIPTION

3.1 INTRODUCTION TO GRAPHS Define a graph Recognize different types of graph Understand the structure of a graph Show how graph are used as a model in variety of areas CHAPTER 3 GRAPHS

TRANSCRIPT

Page 1: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

BCT 2083 DISCRETE STRUCTURE AND APPLICATIONSBCT 2083 DISCRETE STRUCTURE AND APPLICATIONS

CHAPTER 3CHAPTER 3GRAPHSGRAPHS

SITI ZANARIAH SATARISITI ZANARIAH SATARI

FIST/FSKKP UMP I0910FIST/FSKKP UMP I0910

Page 2: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

CHAPTER 3 GRAPHS

CONTENTCONTENT

3.1 Introduction to Graphs3.2 Graph Terminology3.3 Representing Graph and Graph Isomorphism3.4 Connectivity3.5 Euler and Hamilton Paths3.6 Shortest Path Problems 3.7 Planar Graphs3.8 Graph Coloring

Page 3: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.1 INTRODUCTION TO GRAPHS3.1 INTRODUCTION TO GRAPHS

• Define a graph

• Recognize different types of graph

• Understand the structure of a graph

• Show how graph are used as a model in variety of areas

CHAPTER 3 GRAPHS

Page 4: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

► A graph G = (V, E) consists of o V – a nonempty set of vertices (or nodes) ⇛ represents by point

Infinite vertex set – Infinite graph Finite vertex set – Finite graph

o E – a set of Edges ⇛ represents by line segments or curve Each edge has either one or two vertices associated with it,

called its endpoints. An edge is said to connect its endpoint.o The way we draw a graph is arbitrary as long as the correct

connections between vertices are depicted. Avoid crossing edge.

► Example of graph – refer Figure: • 3 vertices ⇛ V = {a, b, c}• 3 edges ⇛ E = {e1, e2, e3} = {{a, a}, {a, b}, {b, c}}

3.1 INTRO

DUCTIO

N TO

GRAPHS

What is Graph (Undirected Graph)? What is Graph (Undirected Graph)?

b

a c

e3e2

e1

Page 5: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

► A simple graph contains no loop or parallel edgeso No loop ⇛ Each edge connects two different verticeso No parallel ⇛ No two edges connect the same pair of vertices

► Example of simple graph and not a simple graph

3.1 INTRO

DUCTIO

N TO

GRAPHS

What is Simple Graph? What is Simple Graph?

b

a c

e3e2

e1

b

a c

e3e2

e1

b

a

c

e3e2

e1

simple graph not a simple graph not a simple graph

Page 6: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

► Multigraphs

o Graph that may have multiple edges connecting the same vertices.

► Psuedographs

o Graph that may include loops, and possibly multiple edge connecting the same vertices.

3.1 INTRO

DUCTIO

N TO

GRAPHS

Multigraphs & Psuedographs Multigraphs & Psuedographs

ba

c

e3

e2

e1

b

a

c

e3e2

e1

e5e4

Page 7: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

► A graph directed (or digraph) (V, E) consists of o V – a nonempty set of Vertices (or nodes) ⇛ represents by pointo E – a set of directed Edges ⇛ represents by line segments or

curve Each directed edge associated with an ordered pair of

vertices (u, v), which said to start at u and end at v.

► Simple directed graph – a directed graph with no loops and no multiple directed edges

► Directed multigraph – a directed graph with multiple directed edge► Mixed graph – a graph with both directed and undirected edges

► Example of directed graph • refer Figure:

3.1 INTRO

DUCTIO

N TO

GRAPHS

What is Directed Graph? What is Directed Graph?

b

a c

e3e2

e1

Page 8: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.1 INTRO

DUCTIO

N TO

GRAPHS

Summary: Types of Graph & its Structure Summary: Types of Graph & its Structure

Type Edges Multiple Edges Allowed?

Loops Allowed?

Simple Graph Undirected No No

Multigraph Undirected Yes No

Psuedograph Undirected Yes Yes

Simple Directed Graph

Directed No No

Directed Multigraph Directed Yes Yes

Mixed Graph Directed and Undirected

Yes Yes

Page 9: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.1 INTRO

DUCTIO

N TO

GRAPHS

1. For each of the following graph, • Determine the type of graph• Find the number of vertices and edges• If the graph is a not simple undirected graph, find a set of

edges to remove to make it simple graph.

EXERCISE 3.1EXERCISE 3.1

b

a

ca

b c

b

a c

e

f da c

b d

Page 10: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.1 INTRO

DUCTIO

N TO

GRAPHS

• When we build a graph model, we need to make sure that we have correctly answered three key questions about the structure of a graph as following:

1. Are the edges of graph undirected or directed or both?2. If the graph is undirected, are multiple edges present

that connect the same pair of vertices? If the graph is directed, are multiple directed edges presents?

3. Are loops present?

How to Graph a ModelHow to Graph a Model

Page 11: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.1 INTRO

DUCTIO

N TO

GRAPHS

1. Computer networks• A network is made up of data

centers (represents the location by point) and communication links between computer (represents the links by line segments).

2. Niche overlap graphs in ecology• Involve interaction of different

species of animals• Model the competition between

species in an ecosystem• Represents species by vertices • Represents a competition by line

Examples of Graph ModelsExamples of Graph Models

owl

squirrel

raccoon

KL

JB

KTN

KB

M

KT

crowoppossum

shrew mouse wood pecker

Page 12: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.1 INTRO

DUCTIO

N TO

GRAPHS

3. Influence Graph• Model group behavior• Certain people can influence the

thinking of others • Represents people by vertices • Represents an influence by line• Directed graph

4. Round-Robin Tournaments • Each team plays each other team

exactly one• Represents teams by vertices • Represents a directed play by line

Examples of Graph ModelsExamples of Graph Models

linda

Fred Kris

Brian

May

T3T1

T4T2

Page 13: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.1 INTRO

DUCTIO

N TO

GRAPHS

2. Draw the acquaintanceship graph that represents that Tom and Pat, Tom and Hope, Tom and Sam, Tom and Amy, Tom and Mari, Jeff and Pat, Jeff and Mari, Pat and Hope, Amy and Hope, and Amy and Mari know each other, but none of the other pairs pf people in listed know each other.

3. A company wish to schedule 1-hour meeting beginning at 7 A.M. between every two of its six regional managers – A, B, C, D, E, and F, so each can spend an hour with each of the other five for better acquaintance. Find the various possible schedule pairings.

4. Draw a call graph for telephone numbers 5550011, 5551221, 5551333, 5558888, 5552222, 5550091 and 5551200 if there were three calls from 5550011 from 5558888 and two calls from 5558888 to 5550011, two calls from 5552222 to 5550091, two calls from 5551221 to each of the others numbers, and no one call from 5551333 to each of 5550011, 5551221, and 5551200.

EXERCISE 3.1EXERCISE 3.1

Page 14: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.1 INTRO

DUCTIO

N TO

GRAPHS

EXERCISE 3.1 : EXTRAEXERCISE 3.1 : EXTRA

PAGE : 595, 596 and 597

Rosen K.H., Discrete Mathematics & Its Applications, (Seventh Edition), McGraw-Hill, 2007.

Page 15: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.23.2 GRAPH TERMINOLOGYGRAPH TERMINOLOGY

• Introduce the basic terminology of graph theory

• Introduce several classes of simple graph

• Introduce bipartite graph

• Introduce subgraph

CHAPTER 3 GRAPHS

Page 16: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• Adjacent• Incident• Degree• Isolated• Pendant• Initial Vertex• Terminal• In-Degree/Out-Degree• Bipartite• Subgraph

Graph TerminologyGraph Terminology

Page 17: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• Two vertices u and v in an undirected graph G are called adjacent (or neighbors) in G if u and v are endpoints of an edge of G.

• If the edge e is associated with {u, v}, e is called incident with the vertices u and v. (e connect u and v)

• Example:– a and b are adjacent– a and c not adjacent– e2 incident with a and b

Adjacent and IncidentAdjacent and Incident

b

a c

e3e2

e1

Page 18: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

Degree, Isolated and PendantDegree, Isolated and Pendant• The degree of a vertex in an undirected graph is the number of

edges incident with it.

• A loop at a vertex contributes twice to the degree of that vertex

• The degree of the vertex v is denoted by deg (v).

• A vertex of degree zero is called isolated. (not adjacent to any vertex)

• A vertex is pendant iff it has degree one.

• Example:

– deg (a) = 3 , deg (b) = 2– deg (c) = 1 , so vertex c is pendant– deg (d) = 0 , so vertex d is isolated

b

a c

e3e2

e1 •d

Page 19: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

1. For each of the following graph, • Find the degree of each vertex• Identify all the isolated and pendant vertices

EXERCISE 3.2EXERCISE 3.2

b

a

ca

b c

b

a c

e

f da c

b d

•g

d

Page 20: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

1. The Handshaking Theorem:• Let G = (V, E) be an undirected graph with e edges. Then

• This theorem also applies if multiple edges and loops are present.• Example: How many edges are there in a graph with 10 vertices each of degree 6?

2. An undirected graph has an even number of vertices of odd degree.

Theorem involving DegreesTheorem involving Degrees

2 degv V

e v

Page 21: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• When (u, v) is an edge of the graph G with directed edges, u is said to be adjacent to v and v is said to be adjacent from u.

• The vertex u is called the initial vertex of (u, v), and v is called the terminal or end vertex of (u, v).

• The initial vertex and terminal vertex of a loop are the same.

• Example– a is adjacent to b– b is adjacent to c– Vertex a is initial vertex of (a, b)– Vertex b is terminal vertex of (a, b)

Initial and Terminal VertexInitial and Terminal Vertex

b

a c

e3e2

e1

Page 22: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• For directed graph, the in-degree of a vertex v, denoted by deg⁻ (v), is the number of edges with v as their terminal vertex.

• For directed graph, the out-degree of a vertex v, denoted by deg⁺ (v), is the number of edges with v as their initial vertex.

• Loop at a vertex contributes 1 to both the in-degree and the out-degree of this vertex.

• The summation:

• Example:

–The in-degrees in G are:•deg⁻ (a) = 1 , deg⁻ (b) = 1•deg⁻ (c) = 3 , deg⁻ (d) = 2

–The out-degrees in G are:•deg⁺ (a) = 1 , deg⁺ (b) = 4•deg⁺ (c) = 1 , deg⁺ (d) = 1

In-Degree and Out-DegreeIn-Degree and Out-Degree

a c

b d

deg degv V v V

v v E

Page 23: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

2. For each of the following directed graph, • Find the in-degree and out-degree of each vertex

EXERCISE 3.2EXERCISE 3.2

b

a

c a

b c

b

a c

ef d

•g

d

b

a c

e3e2

e1

Page 24: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• Complete Graph• Cycles• Wheels• n-Cubes

Some Special Simple GraphSome Special Simple Graph

Page 25: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• The Complete Graph on n vertices, denoted by Kn, is the simple graph that contains exactly one edge between each pair of distinct vertices.

• Example: the graph Kn for 1 ≤ n ≤ 5.

Complete GraphComplete Graph

•K1 K5K4K3K2

Page 26: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

CyclesCycles• The Cycle Cn, n ≥ 3, consists of n vertices v1, v2, … vn and

edges {v1, v2}, {v2, v3}, …, {vn-1,vn} and {vn, v1}.

• Example: the Cn for 3 ≤ n ≤ 6.

C5C4C3 C6

Page 27: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

WheelsWheels• The Wheel Wn, n ≥ 3, is obtain when we add an additional

vertex (usually at the center) to the cycle Cn and connect this new vertex to each of the n vertices in Cn by new edges.

• Example: the Wn for 3 ≤ n ≤ 6.

W5W4W3 W6

•• •

Page 28: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• The n-dimensional hypercube, or n-cube, denoted by Qn, is the graph that has vertices representing bit strings of length n.

• Example: the graph Qn for 1 ≤ n ≤ 3.

nn-Cube-Cube

Q1 Q3Q2

0 1

10 11

00 01

100 101

000 001

110 111

010 011

Page 29: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

• A simple graph G is called bipartite if the vertex set V can be partitioned into two disjoint (nonempty) sets V1 and V2, so every edge in G is incident with a vertex in V1 and a vertex in V2.

• We call the pair (V1, V2) a bipartition of the vertex set V of G.

• Example 1: C6 is bipartite– Let V1 = {a, c, e} – Let V2 = {b, d, f}– Every edge of C6 connects a vertex in V1 and V2

• Example 2: W4 is not bipartite– Let V1 = {a, c, e} – Let V2 = {b, d}– Edge (a, e) of W4 not connects a vertex

in V1 and V2

3.2 GRAPH TERMIN

OLO

GY

Bipartite GraphsBipartite Graphs

a

ba

c

e

f

d

d

ba

c

e

Page 30: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• Let G be a bipartite graph with |V1| = m and |V2| = n. If an edge runs between every vertex in V1 and V2, G is a complete bipartite graph, denoted by Km,n.

• Example:

Complete Bipartite GraphComplete Bipartite Graph

a

K2,3

b

c d e

Let V1 = {a, b} Let V2 = {c, d, e}An edge runs between vertex in V1 and V2

Page 31: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

3. Is each of the following graph bipartite? If so, identify the vertex sets V1 and V2.

EXERCISE 3.2EXERCISE 3.2

b

a c

ef d

b

a c

e

d

4. Draw the following graphs

a) K2,4

b) K3,5

Page 32: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

1. Job Assignments• m employees • j different jobs (m ≤ j)• Model employees

capabilities• Each employee trained

to do one or more job (blue line)

• Assignment of jobs (green line)

• Bipartite graph

Applications of Special Types of GraphApplications of Special Types of Graph

Ali Ben Chu Dev

Requ

irem

ents

arch

itect

ure

impl

emen

tatio

n

testi

ng

• We are trying to find a matching in a graph model.

•A matching is a subset of the set of edges such that no two edges are incident with the same vertex

Page 33: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

2. Local Area Network• Illustrate the connection

between various computers and devices

• Star topology : K1,n

• All devices connected to a central control device

• Ring topology : n Cycles (Cn)• Each device is connected to

exactly two others

• Hybrid topology : star + ring• Redundancy makes the

network more reliable

Applications of Special Types of GraphApplications of Special Types of Graph

Page 34: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• A subgraph of a graph G = (V, E) is a graph H = (W, F), where W ⊆ V and F ⊆ E .

• A subgraph H of G is a proper subgraph of G if H ≠ G.

SubgraphSubgraph

K5 a few subgraph of K5

b

a c

e d

b

a

e d

b

a c

e d

Page 35: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

• The Union of two simple graphs G1 = (V1, E1) and G2 = (V2, E2) is the simple graph with vertex set V1 ∪ V2 and edge set E1 ∪ E2 .

• The union of G1 and G2 is denoted by G1 ∪ G2 .

Union of GraphsUnion of Graphs

G1

a b c

d e

G1 ∪G2

a b c

d e

G2

a b c

d f f

Page 36: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

5. Find the union of the following graphs

a.

b.

EXERCISE 3.2EXERCISE 3.2

a

b

c

f

e

d

a c

eb

a c

e

b

a cd

Page 37: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.2 GRAPH TERMIN

OLO

GY

EXERCISE 3.2 : EXTRAEXERCISE 3.2 : EXTRA

PAGE : 608, 609, 610 and 611

Rosen K.H., Discrete Mathematics & Its Applications, (Seventh Edition), McGraw-Hill, 2007.

Page 38: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.33.3 REPRESENTING GRAPH AND GRAPH ISOMORPHISMREPRESENTING GRAPH AND GRAPH ISOMORPHISM

• Represent graphs using adjacency lists

• Represent graphs using adjacency matrix

• Represent graph using incidence matrix

• Show that two graphs are isomorphic

CHAPTER 3 GRAPH

Page 39: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• Adjacency List– Specify the vertices that are adjacent to each vertex of

the graph

• Adjacency Matrix– Represents graph by a matrix based on the adjacency

of vertices

• Incidence Matrix– Represents graph by a matrix based on the incidence of

vertices and edges.

Representing GraphsRepresenting Graphs

Page 40: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• Specify the vertices that are adjacent to each vertex of the graph

Adjacency List (UnDirected Graph)Adjacency List (UnDirected Graph)

Adjacency List

Vertex Adjacent Vertices

a b, c, e

b a

c a, d, e

d c, e

e a, c, d

a

b

c

e d

Page 41: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• List all the vertices that are the terminal vertices of edges starting at each vertex of the graph

Adjacency List (Directed Graph)Adjacency List (Directed Graph)

Adjacency List

Initial Vertex Terminal Vertices

a b, d

b c

c b

d b, c, dd c

a b

Page 42: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

1. Use an adjacency list to represent the given graph

EXERCISE 3.3EXERCISE 3.3

a b c

d e f

a b

dc eb a

b c

e d

a c

d

FIGURE 1

FIGURE 2

FIGURE 3

FIGURE 4

Page 43: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• If A = [aij] is the adjacency matrix for simple undirected graph G with n vertices v1, v2, …, vn, then

• EXAMPLE: Use adjacency matrix to represent the graph below.

Adjacency Matrix (Simple UnDirected Graph)Adjacency Matrix (Simple UnDirected Graph)

a

b

c

e d

0 1 1 0 11 0 0 0 01 0 0 1 10 0 1 0 11 0 1 1 0

A

1 if { , } is an edge of

0 otherwisei j

ij

v v Ga

a b c eda

bc

e

d

A is symmetric

Page 44: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• Aij is represent by the number of edges that associated to [ai , aj]

• A loop at a vertex represent by 1 • When multiple edges are present, adjacency matrix is no

longer a zero-one matrix.• The matrix is symmetric• EXAMPLE: Use adjacency matrix to represent the graph

below.

Adjacency Matrix (not Simple UnDirected Graph)Adjacency Matrix (not Simple UnDirected Graph)

a b

d c

0 3 0 13 0 1 00 1 1 21 0 2 0

A

a b c da

b

c

d

Page 45: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• Aij is represent by the number of edges from ai to aj

• A loop at a vertex represent by 1 • When multiple edges are present, adjacency matrix is no

longer a zero-one matrix.• The matrix is not symmetric• EXAMPLE: Use adjacency matrix to represent the graph

below.

Adjacency Matrix (Directed Graph)Adjacency Matrix (Directed Graph)

0 1 0 00 0 2 00 0 0 01 1 1 1

A

a b c da

b

c

dd c

a b

Page 46: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

2. Represent the graph with an adjacency matrix

EXERCISE 3.3EXERCISE 3.3

a b c

d e f

a b

dc eb a

b c

e d

a c

d

FIGURE 1

FIGURE 2

FIGURE 3

FIGURE 4

Page 47: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• An adjacency matrix of a graph is based on the ordering chosen for the vertices.

• There are n! different adjacency matrices for a graph with n vertices, because there are n! different ordering of n vertices

• EXAMPLE: Draw a graph with the given adjacency matrix

Draw Graph from Adjacency Matrix Draw Graph from Adjacency Matrix

a

b

c

e d

0 1 1 0 11 0 0 0 01 0 0 1 10 0 1 0 11 0 1 1 0

A

a b c eda

bc

e

d

Page 48: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

3. Draw a graph with the given adjacency matrix

0 1 1 01 0 0 11 0 0 10 1 1 0

A

EXERCISE 3.3EXERCISE 3.3

0 3 0 23 0 1 10 1 1 22 1 2 0

A

0 1 0 00 0 2 00 0 0 01 1 1 1

A

a) b)

c)

Page 49: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• The incidence matrix for undirected graph G with n vertices v1, v2, …, vn, and m edges e1, e2, …, em, is the m × n matrix M = [mij], where

• EXAMPLE: Use incidence matrix to represent the graph below.

Incidence Matrices Incidence Matrices

1 when edge is incidence with vertex

0 otherwisej i

ij

e vm

a b

c

1 1 0 1 0 11 1 1 0 0 00 0 1 1 0 00 0 0 0 1 1

M

e1 e2 e3 e4

a

b

c

dd

e1

e2e6 e3

e5

e4

e5 e6

Page 50: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

4. Represent the graph with an incidence matrix

EXERCISE 3.3EXERCISE 3.3

a b c

d e f

b

a c

d

a b

cd

e1

e2e6 e3e5

e4

e e7

e1 e2

e6

e3e5

e4e7e8

e1

e2

e6

e3

e5

e4

FIGURE 1

FIGURE 3

FIGURE 2

Page 51: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• Two simple graphs G1 = (V1, E1) and G2 = (V2, E2) are isomorphic if there is a one-to-one and onto function (bijection) f from V1 and V2 with the property that a and b are adjacent in G1 if and only if f (a) and f (b) are adjacent to G2, for all a and b in V1.

• f is called an isomorphism.

• When G1 and G2 are isomorphic, there is one-to-one correspondence between vertices of the two graphs that preserves the adjacency relationship.

• Isomorphism of simple graphs is an equivalence relation.

• There are n! possible one-to-one correspondence between the vertex sets of two simple graphs with n vertices.

Isomorphism of Graphs Isomorphism of Graphs

Page 52: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• For Two simple graphs G1 = (V1, E1) and G2 = (V2, E2) to be isomorphic

– |V1| = |V2| – |E1| = |E2| – The corresponding vertices in G1 and G2, will

have the same degree.– A bijection f : V1 → V2 should preserve the adjacency

relationship:– If {a, b} is an edge in E1 then {f (a), f (b)} must be an

edge in E2. – If { f (a), f (b)} is an edge in E2 then {a, b} must be an

edge in E1.

Isomorphism of Graphs (CONDITIONS TIPS) Isomorphism of Graphs (CONDITIONS TIPS)

Isomorphism invariant

Page 53: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• The graphs G1 and G2 are isomorphic since:

– |V1| = |V2|= 4 and |E1| = |E2| = 5 – Function f with f (a) = u, f (b) = v, f (c) = w, and f

(d) = x, is bijection.– deg (a) = deg (f (a)) = 2, deg (b) = deg (f (b)) = 3,

deg (c) = deg (f (c)) = 3, deg (a) = deg (f (a)) = 2.– Adjacency relationship:

Example 1: Isomorphism of GraphsExample 1: Isomorphism of Graphs

G1

b c

a d

G2

v

wu x

{x,y} in E1 {f(x), f(y)} Is {f(x), f(y)} in E2 ?

{a, b} {f(a), f(b)} = {u, v} Yes

{a, c} {f(a), f(c)} = {u, w} Yes

{b, c} {f(b), f(c)} = {v, w} Yes

{b, d} {f(b), f(d)} = {v, x} Yes

{c, d} {f(c), f(d)} = {w, x} Yes

Page 54: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• The graphs G1 and G2 are not isomorphic since:

– |V1| = |V2|= 8 and |E1| = |E2| = 10 – BUT– deg (a) = 2, in G1 . – a must correspond to either t, u, x, or y in G2 since deg (t) = deg (u) =

deg (x) = deg (y) = 2 . – However, each of these four vertices is adjacent to another vertex of

degree 2 which is not true for a. (a adjacent with to another vertex of degree 3)

Example 2: Isomorphism of GraphsExample 2: Isomorphism of Graphs

G1

b

c

a

dG2

e f

h g

t

u

s

v

w x

z y

Page 55: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

• For Two simple graphs G1 = (V1, E1) and G2 = (V2, E2) to be isomorphic

– the adjacency matrix of G1

is the same as

– the adjacency matrix of G2, with rows and column are labeled by the images of corresponding vertices in G1

Isomorphism of Graphs (by adjacency matrix) Isomorphism of Graphs (by adjacency matrix)

Page 56: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

0 1 1 01 0 1 11 1 0 10 1 1 0

G2A

• The graphs G1 and G2 are isomorphic since:

– |V1| = |V2|= 4 and |E1| = |E2| = 5 – Function f with f (a) = u, f (b) = v, f (c) = w, and f

(d) = x, is bijection.

– Adjacency matrix of G1:

– Adjacency matrix of G2 with rows and column are labeled by the images of corresponding vertices in G1:

Example 2: Isomorphism of GraphsExample 2: Isomorphism of Graphs

G1

b c

a d

G2

v

wu x

0 1 1 01 0 1 11 1 0 10 1 1 0

G1A

aa

b

b

d

dc

c

uu

v

v

x

xw

w

Page 57: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

5. Determine if the following graph are isomorphic.

EXERCISE 3.3EXERCISE 3.3

G

u1 u2

u3 u4

H

v1 v2

v3 v4

e

d

c

a bG1

G2

v1 v2

v5

v4

v3

v1 v2

v3 v4

G1

G2

v5

e

d

ca

b

Page 58: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.3 REPRESENTIN

G GRAPH AND GRAPH ISO

MO

RPHISM

EXERCISE 3.3 : EXTRAEXERCISE 3.3 : EXTRA

PAGE : 618, 619, 620 and 621

Rosen K.H., Discrete Mathematics & Its Applications, (Seventh Edition), McGraw-Hill, 2007.

Page 59: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CONNECTIVITY3.4 CONNECTIVITY

• Define a path in graph

• Define connectedness in undirected graph

• Define connectedness in directed graph

• Show that two graphs are isomorphic using paths

• Count the number of paths between vertices in graph

CHAPTER 3 GRAPHS

Page 60: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

• A path of length n is a sequence of n edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph.

• The path is a circuit (or cycle) if it begins and ends at the same vertex.

• A path or a circuit is simple if it does not contain the same edge more than once.

• EXAMPLE:

– a, d, c, f, e is a path– d, e, c, a is a not a path– b, c, f, e, b is a circuit– a, b, e, d, a, b is not a simple path

Paths Paths

a b

d e

c

f

Page 61: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

1. Does each of the following lists of vertices form a path in the following graph? Which path are simple? Which are circuits? What are the lengths of those that are paths?

EXERCISE 3.4EXERCISE 3.4

a b c

d eFIGURE 1

d c

a

FIGURE 2

b

i) a, e, b, c, b

ii) a, e, a, d, b, c, a

iii) e, b, a, d, b, e

iv) c, b, d, a, e, c

i) a, b, c, d, a

ii) a, d, d, b, c, b

iii) d, b, c, b

iv) c, a, b, d

Page 62: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

• Paths in an Acquaintanceship Graphs– There is a path between two people if there is a chain of

people linking these people, where two people adjacent in the chain know one another.

– EXERCISE: Find a path for acquaintanceship graph in Exercise 3.1 (2).

• Connectedness– When a graph is used to represent a computer network

which edges represents the communication links, when is there always a path between two vertices in the graph?

Paths & ApplicationsPaths & Applications

Page 63: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

• An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph.

Connectedness in Undirected GraphsConnectedness in Undirected Graphs

a b

g e

FIGURE 1 FIGURE 2

The graph is Connected since for every pair of distinct vertices there is path between them.

The graph is not Connected since there is no path between vertices a and d.

cf d

f

e

d

b

a c

Page 64: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

2. Determine if each of the following is a connected graph.

EXERCISE 3.4EXERCISE 3.4

a b c

d eFIGURE 1

a b

c d e

FIGURE 2

a

d

c d e

FIGURE 3

Page 65: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

• A connected component of a graph G is a connected subgraph of G that is not a proper subgraph of another connected subgraph of G.

• A connected component of a graph G is a maximal connected subgraph of G.

• A graph G that is not connected has two or more connected components that are disjoint and have G as their union.

Connected ComponentConnected Component

EXAMPLE

Graph G

The graph G is the union of three disjoint connected subgraphs G1, G2, and G3. These subgraphs are the connected components of G.

f

e

d

b

a c

hgb

a c

hg

f

e

dG1 G3

G2

Page 66: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

3. How many connected components does each of the following graphs have?

EXERCISE 3.4EXERCISE 3.4

a b c

d eFIGURE 1

a b

c he

FIGURE 2

a

d

c d e

FIGURE 3

f

gd

b

a c

ef d

FIGURE 4

Page 67: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

• A vertex is a cut vertex (articulation point) when the removal of this vertex produces a subgraph that is not connected.

• An Edge is a cut edge (bridge) when the removal of this edge produces a subgraph that is not connected.

• The cut edge incidence with the cut vertex.

Cut Vertices and Cut EdgesCut Vertices and Cut Edges

EXAMPLE

Graph G

The cut vertices of G are b, c, and e.

The cut edges of G are {a, b} and {c, e}

f

e

d

b

a

c h

g

Page 68: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

4. Find the cut vertices and cut edges of the following graph.

EXERCISE 3.4EXERCISE 3.4

a b c

d eFIGURE 1

a b

c d e

FIGURE 2

a

b

c d

e

FIGURE 3

Page 69: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

• A directed graph is strongly connected if there is a path from a to b and from b to a whenever a and b are vertices in the graph.

• A directed graph is weakly connected if there is a path between every two vertices in the underlying undirected graph (when the direction is disregarded).

• Any strongly connected graph is also weakly connected.

Connectedness in Directed GraphConnectedness in Directed Graph

EXAMPLE

Graph G

G is strongly connected and weakly connected

H is not strongly connected but weakly connected

d

c

a b

eGraph H

d

c

a b

e

Page 70: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

5. Determine whether each of the following graph is strongly connected and if not, whether it is weakly connected.

EXERCISE 3.4EXERCISE 3.4

FIGURE 1 FIGURE 2

f

dFIGURE 3

a b

dc e

a

b c

d

ca b

e

Page 71: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

• A strongly connected components or strong component of G is the subgraphs of a directed graph G that are strongly connected by not contained in larger strongly connected subgraphs, that is , the maximal strongly connected subgraphs.

Strongly Connected ComponentsStrongly Connected Components

EXAMPLE

Graph H has three strongly connected components:

• Vertex a

• Vertex e

• Vertices b, c, d Graph Hd

c

a b

e

Page 72: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

6. Find the strongly connected components of each of the following graph.

EXERCISE 3.4EXERCISE 3.4

FIGURE 1 FIGURE 2f

dFIGURE 3

a

b c

d

ca b

e d

ca b

e

Page 73: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

• Graphs, G1 and G2 are isomorphism only if in both graph exist a simple circuit of same length k (k >2).

Paths and IsomorphismPaths and Isomorphism

EXAMPLE

Graph G and H, both have 6 vertices and 8 edges.

Each has 4 vertices of degree three, and two vertices pf degree two.

H has a simple circuit of size three but all simple circuits in G have length at least four. So, G and H are not isomorphic.

a

b

f d

GRAPH G GRAPH Hc

e

v

u

w

x

s

t

Page 74: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

EXERCISE 3.4EXERCISE 3.47. Determine if the following graph are isomorphic.

G

u1 u2

u3 u4

H

v1 v2

v3 v4

e

d

c

a bG1

G2

v1

v2

v5

v4

v3

v1 v2

v3 v4

G1

G2v5

e

d

ca

b

Page 75: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

• Let G be a graph with adjacency matrix A with respect to the ordering v1, v2, …, vn (with directed or undirected edges, with multiple edges or loops allowed). The number of different paths of length r from vi to vj, where r is a positive integer, equals the (i, j)th entry of .rA

Counting Paths between VerticesCounting Paths between Vertices

EXAMPLE

How many paths of length 4 are there from a to d in G?

Graph G

a b

d c

0 1 1 01 0 0 11 0 0 10 1 1 0

A

8 0 0 80 8 8 00 8 8 08 0 0 8

4A

Hence, there are 8 paths of length 4 from a to d.

Page 76: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

8. Find the number of paths of length 2 between a to c of the following graphs.

EXERCISE 3.4EXERCISE 3.4

a b c

d e

FIGURE 1 FIGURE 2

d

ca b

e

Page 77: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.4 CON

NECTIVITY

EXERCISE 3.4 : EXTRAEXERCISE 3.4 : EXTRA

PAGE : 629, 630, 631, 632 and 633

Rosen K.H., Discrete Mathematics & Its Applications, (Seventh Edition), McGraw-Hill, 2007.

Page 78: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.53.5 EULER AND HAMILTONIAN PATHSEULER AND HAMILTONIAN PATHS

• Determine Euler paths and Euler circuits in a graph

• Determine Hamiltonian paths and Hamiltonian circuits in a graph

CHAPTER 3 GRAPHS

Page 79: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

1. Can we travel along the edges of a graph starting at a vertex and returning to it by traversing each edge of the graph exactly one?

• Solve by Euler circuit by examining the degree of vertices

2. Can we travel along the edges of a graph starting at a vertex and returning to it while visiting each vertex of the graph exactly one?

• Solve by Hamiltonian circuit by examining the degree of vertices

IntroductionIntroduction

Page 80: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

• Discovered by Swiss Mathematician Leonhard Euler (1736).

• An Euler circuit in a graph G is a simple circuit containing every edge of G.

• An Euler path in a graph G is a simple path containing every edge of G.

• NECESSARY & SUFFICIENT CONDITIONS:– Theorem 1: A connected multigraph with at least two

vertices has an Euler circuit if and only if each of its vertices has even degree.

– Theorem 2: A connected multigraph has an Euler path but not an Euler circuit if and only if its has exactly two vertices of odd degree.

Euler Paths and CircuitsEuler Paths and Circuits

Page 81: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

EXAMPLES: Euler Paths and CircuitsEXAMPLES: Euler Paths and Circuits

a b

ed c

a b

c ed

Euler Circuit: G1 (a, e, c, d, b, a)

Euler Path: G3 (a, c, d, e, b, d, a, b)

G2: no Euler path and Euler circuit

G1 G3G2

d

a b

e

Page 82: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

• Seven bridge of Konigsberg problem: it is possible to start at some location at the town (Prussia), travel across all the bridges without crossing any bridge twiwe, and return to starting point.

• We can find a path or circuit that traverse:–Each street in a neighborhood exactly one.–Each road in a transportation network exactly one.–Each link in communication network exactly one.

• Euler path or circuit also applied in–Layout of circuits.–Network multitasking.–Molecular biology (DNA sequencing)

Applications: Euler Paths and CircuitsApplications: Euler Paths and Circuits

Page 83: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

1. Which of the following graphs have an Euler Circuit? Of those that do not, which have an Euler path?

EXERCISE 3.5EXERCISE 3.5

a b

e

d c

d c

a be

FIGURE 1

FIGURE 3FIGURE 2

FIGURE 4

g

a b

c

d

f

r s

z

uv w

t

x y

Page 84: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

• Discovered by Irish Mathematician Sir william Rowan Hamilton (1857) • A Hamiltonian circuit in a graph G is a simple circuit that passes

through every vertex in G exactly once.• A Hamiltonian path in a graph G is a simple path that passes through

every vertex in G exactly once.• CERTAIN PROPERTIES IN HAMILTONIAN CIRCUIT (HC):

– A graph with a vertex of degree one cannot have HC, because each vertex in HC is incident with two edges.

– If a vertex has degree two, then both edges that are incident with this vertex must be part of any HC.

– When a HC is being constructed and this circuit passes through a vertex, then all remaining edges incident with this vertex, other than two used in the circuit, can be removed from consideration.

– HC cannot contain a smaller circuit within it.

Hamiltonian Paths and CircuitsHamiltonian Paths and Circuits

Page 85: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

• NECESSARY & SUFFICIENT CONDITIONS:– The more edges a graph has, the more likely it is to have

a HC.

– Adding edges (but not vertices) to a graph with a HC produces a graph with the same HC.

– DIRAC’S Theorem: If G is a simple graph with n vertices with n ≥ 3 such that the degree of every vertex in G is at least n/2, then G has a HC.

– ORE’S Theorem: If G is a simple graph with n vertices with n ≥ 3 such that deg (u) + deg (v) ≥ n for every pair of nonadjacent vertices u and v in G, then G has a HC.

Hamiltonian Paths and CircuitsHamiltonian Paths and Circuits

Page 86: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

EXAMPLES: Hamiltonian Paths and CircuitsEXAMPLES: Hamiltonian Paths and Circuits

a b

d

e c

b c

e gf

Hamiltonian Circuit: G1 (a, b, c, d, e, a)

Hamiltonian Path: G2 (a, b, c, d)

G3: no Hamiltonian path and Hamiltonian circuit

G1 G3G2

d

a b

c

a

d

Page 87: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

• Icosian Games– a mathematical game invented in 1857 by William Rowan Hamilton. The game's object is

finding a Hamiltonian cycle along the edges of a dodecahedron such that every vertex is visited a single time, no edge is visited twice, and the ending point is the same as the starting point. The puzzle was distributed commercially as a pegboard with holes at the nodes of the dodecahedral graph and was subsequently marketed in Europe in many forms.

• We can find a path or circuit that visits:– Each road intersection in a city exactly once.– Each place pipelines intersect in a utility grid. – Each node in a communications network exactly once.

• Euler path or circuit also applied in– Traveling salesman problem which asks for the shortest route a traveling

salesman should take to visit a set of cities. – Gray Code: labeling the arcs of a circle such that adjacent arcs are labeled

with bit strings that differ in exactly one bit.

Applications: Applications: Hamiltonian Paths and CircuitsHamiltonian Paths and Circuits

Page 88: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

2. Which of the following graphs have an Hamiltonian Circuit? Of those that do not, which have an Hamiltonian path?

EXERCISE 3.5EXERCISE 3.5

a b

e

d c e

FIGURE 1

FIGURE 2 FIGURE 3

g

a

b

c

d a

g

bd

f

e

c

f

f

h

Page 89: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.5 EULER AN

D HAMILTO

NIAN

PATHS

EXERCISE 3.5 : EXTRAEXERCISE 3.5 : EXTRA

PAGE : 643, 644, 645, 646 and 647

Rosen K.H., Discrete Mathematics & Its Applications, (Seventh Edition), McGraw-Hill, 2007.

Page 90: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.63.6 SHORTEST PATH PROBLEMSHORTEST PATH PROBLEM

• Understand shortest path problem

• Find the length of a shortest path between vertices using Dijkstra’s algorithm

• Understand and solve traveling salesman problem

CHAPTER 3 GRAPHS

Page 91: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

• Graphs that have a number assigned to each edge are called weighted graphs.

• Problems which modeled using weighted graphs

– Airline system (vertices: cities, edges: flight distances/ times/fares)

– Computer network (vertices: computers, edges: communication costs/response times/ distances)

Weighted GraphsWeighted Graphs

KL

JB

KTN

KB

M

KT

• Types of problems need to solve:– Shortest path/ path of least length:

• Smallest flight time, cheapest fare, fastest response time, shortest distance.

– A circuit with shortest total length that visits every vertex of a complete graph exactly once:

• Traveling salesman problem.

31

24

1

2

2

3

Page 92: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

• What is the length of a shortest path between a to z in the given weighted graph?

We will solve this problem by finding the length of a shortest path from a to successive vertices, until z is reach.

Shortest-Path Algorithm Shortest-Path Algorithm (Motivation)(Motivation)

1. List all the possible path with its length• a – b – c – z (length: 9)• a – b – e – z (length: 8)• a – d – e – z (length: 6)

2. Chose a path with the shortest length• a – d – e – z (length: 6)

a

cb

z

d

a

e

4

3

2

3

2

1

3

HOW?

Page 93: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

Let's call the node we are starting with an initial node. Let a distance of a node Y be the distance from the initial node to it. Dijkstra's algorithm will assign some initial distance values and will try to improve them step-by-step.

1.Assign to every node a distance value. Set it to zero for our initial node and to infinity for all other nodes.

2.Mark all nodes as unvisited. Set initial node as current. 3.For current node, consider all its unvisited neighbors and calculate their distance

(from the initial node). For example, if current node (A) has distance of 6, and an edge connecting it with another node (B) is 2, the distance to B through A will be 6+2=8. If this distance is less than the previously recorded distance (infinity in the beginning, zero for the initial node), overwrite the distance.

4.When we are done considering all neighbors of the current node, mark it as visited (use circle). A visited node will not be checked ever again; its distance recorded now is final and minimal.

5.Set the unvisited node with the smallest distance (from the initial node) as the next "current node" and continue from step 3.

Dijkstra’s AlgorithmDijkstra’s Algorithm

Page 94: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

Use Dijkstra’s Algorithm to find the length of a shortest path between a to z in the given weighted graph.

Example 1: Dijkstra’s AlgorithmExample 1: Dijkstra’s Algorithmdb

z

c

a

e

4

5

2

10

6

3

1 8 2

SOLUTION

db

z

c

a

e

4

5

2

10

6

3

1 8 2

ITERATION 1 ITERATION 2

0

∞ ∞

db

z

c

a

e

4

5

2

10

6

3

1 8 20

4 (a) ∞

∞2 (a)

Page 95: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

Example 1: Dijkstra’s AlgorithmExample 1: Dijkstra’s AlgorithmITERATION 3 ITERATION 4

db

z

c

a

e

4

5

2

10

6

3

1 8 20

3 (a,c)

2 (a)

ITERATION 5

10 (a,c)

12 (a,c)

db

z

c

a

e

4

5

2

10

6

3

1 8 20

3 (a,c)

2 (a)

8 (a,c,b)

12 (a,c)

db

z

c

a

e

4

5

2

10

6

3

1 8 20

3 (a,c)

2 (a)

8 (a,c,b)

10 (a,c,b,d)

14 (a,c,b,d)

Page 96: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

Example 1: Dijkstra’s AlgorithmExample 1: Dijkstra’s AlgorithmITERATION 6

ITERATION 7

db

z

c

a

e

4

5

2

10

6

3

1 8 20

3 (a,c)

2 (a)

8 (a,c,b)

10 (a,c,b,d)

13 (a,c,b,d,e)

db

z

c

a

e

4

5

2

10

6

3

1 8 20

3 (a,c)

2 (a)

8 (a,c,b)

10 (a,c,b,d)

13 (a,c,b,d,e)

• The algorithm terminate when z is circled.

• A shortest path from a to z is a, c, b, d, e, z with length 13.

REMARKS:

Table can also be used to keep tracks of

labels of vertices in each step.

Page 97: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

Use Dijkstra’s Algorithm to find the length of a shortest path between a to z in the given weighted graph.

Example 2: Dijkstra’s AlgorithmExample 2: Dijkstra’s Algorithm

a

db

z

c

a

e

4

5

2

10

6

3

1 8 2

SOLUTION (by table)

Vertex Initially Passes1 2 3 4 5 6

a 0 √ 0 √ 0 √ 0 √ 0 √ 0 √ 0b ∞ 4 a 3 c √ 3 c √ 3 c √ 3 c √ 3 cc ∞ 2 a √ 2 a √ 2 a √ 2 a √ 2 a √ 2 ad ∞ ∞ 10 c 8 b √ 8 b √ 8 b √ 8 be ∞ ∞ 12 c 12 c 10 d √ 10 d √ 10 d z ∞ ∞ ∞ ∞ 14 d 13 e √ 13 e

Page 98: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

1. Use Dijkstra’s Algorithm to find the length of a shortest path between a to z in the following weighted graph.

EXERCISE 3.6EXERCISE 3.6

a

db

z

c

a

e

4

5

3

6

7

4

2 3 1 2

f

g

5

5

a

db

z

c

a

e

2

5

3

5

2

4

2 1

FIGURE 1 FIGURE 2

Page 99: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

EXERCISE 3.6EXERCISE 3.6

Chicago

LA

Denver

San Francisco

191

1372

860

908

1855

722

Boston

Dallas

349957

2. Find a shortest route in distance between computer centers of Boston to Los Angeles in the communication network shown in Figure 1.

3. Find a route with the shortest response time (in second) between computer centres of New York to San Francisco in the communication network shown in Figure 2.

New York

798

1235

645

Chicago

LA

Denver

San Francisco

2

6

3

6

5

4

Boston

Dallas

34

New York

5

5

7

FIGURE 1 FIGURE 2

Page 100: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

4. Solve the traveling salesman problem for the graph in Figure 1 by finding the total weight of all Hamilton circuits and determining the circuit with minimum total weight.

5. Find a route with the least distance that visits each of the cities in the graph in Figure 2.

EXERCISE 3.6 : EXERCISE 3.6 : The Traveling Salesman ProblemThe Traveling Salesman Problem

ba

d c

2

3

7

6

4

5

FIGURE 1 E

B

A 98

58

137

147

113

142

D

56C

133

135

167

FIGURE 2

Page 101: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.6 SHORTEST PATH PRO

BLEMS

EXERCISE 3.6 : EXTRAEXERCISE 3.6 : EXTRA

PAGE : 655, 656 and 657

Rosen K.H., Discrete Mathematics & Its Applications, (Seventh Edition), McGraw-Hill, 2007.

Page 102: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.7 3.7 PLANAR GRAPHPLANAR GRAPH

• Recognize a planar graph

• Use Euler’s formula to find the number of regions in planar graph

• Show that two graphs are homeomorphic

CHAPTER 3 GRAPHS

Page 103: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.7 PLANAR GRAPHS

• A graph is called planar if it can be drawn in the plane without any edges crossing. • Such drawing is called a planar representation of the graph.

EXAMPLE

Planar GraphPlanar Graph

FIGURE 1 : K4 FIGURE 2 : K4 without

crossing

ba

d

c

FIGURE 3 : K3,3 is nonplanar (WHY?)

e f

Page 104: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.7 PLANAR GRAPHS

• Let G be a connected planar simple graph with e edges and v vertices. Let r be the number of regions in a planar representation of G. Then, r = e – v + 2.

• If G is a connected planar simple graph with e edges and v vertices, where v ≥ 3, then e ≤ 3v – 6.

• If G is a connected planar simple graph, then G has a vertex of degree not exceeding five.

• If a connected planar simple graph has e edges and v vertices, with v ≥ 3 and no circuits of length three, then e ≤ 2v – 4.

Euler FormulaEuler Formula

Page 105: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.7 PLANAR GRAPHS

• The graphs G1 = (V1, E1) and G2 = (V2, E2) are called homeomorphic if they can obtained from the same graph by a sequence of elementary subdivisions.

• An elementary subdivision is an operation of removing an edge {u, v} and adding new vertex w together with edges {u, w} and {w, v}.

Homeomorphism Homeomorphism (Kuratowski’s Theorem)(Kuratowski’s Theorem)

a b

c d e

a b

c d e

G1 G2

fg i

h

Graphs G1 and G2 are called homeomorphic because G2 can be obtained from G1 using elementary subdivision.

Page 106: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.7 PLANAR GRAPHS

• A graph is nonplanar if and only if it contains a subgraph homeomorphic to K3,3 or K5.

EXAMPLE

Homeomorphism & Planar GraphHomeomorphism & Planar Graph

G has a subgraph H homeomorphic to K5. Hence G is nonplanar.

G K5H

Page 107: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.7 PLANAR GRAPHS

1. Draw the given planar graph without any crossing.

EXERCISE 3.7EXERCISE 3.7

2. Determine whether the given graph is planar.

a b

c d e

ba

d

c

e

b

a

c

d e f

ba

d

c

e f

g h

Page 108: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.7 PLANAR GRAPHS

EXERCISE 3.7 : EXTRAEXERCISE 3.7 : EXTRA

PAGE : 665 and 666

Rosen K.H., Discrete Mathematics & Its Applications, (Seventh Edition), McGraw-Hill, 2007.

Page 109: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.8 GRAPH COLORING3.8 GRAPH COLORING

• Find the chromatic number of a graph

• Apply graph colorings in solving various problems

CHAPTER 3 GRAPHS

Page 110: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.8 GRAPH COLO

RING

• Each map in the plane can be represented by a graph (Dual Graph).

– Vertex: Region– Edge: Region A and B have a common border

• Dual Graph is planar graph

Maps and Dual GraphsMaps and Dual Graphs

A

B

F

G

E

DC

A map

CG

E

F

B

AD

A Dual Graph

Page 111: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.8 GRAPH COLO

RING

• The problem of coloring the regions of a maps is equivalent to the problem of coloring the vertices of the dual graph so that no two adjacent vertices in the graph have the same color.

• The least number of colors needed for a coloring graph is given by chromatic number which denoted by χ (G).

• The Chromatic number for planar graph is not greater that 4.

Graph ColoringGraph Coloring

A coloring map

CG

E

F

B

AD

A coloring Dual Graph with χ (G) = 4.

Green

Bluered Yellow Blue

Green

red

A

B

F

G

E

DC

Page 112: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.8 GRAPH COLO

RING

1. Construct the dual graph for the map shown. Then find the number of colors needed to color the map so that no two adjacent regions have the same color.

EXERCISE 3.8EXERCISE 3.8

A B

ED

C

FIGURE 1 FIGURE 2

AB E

DCF

Page 113: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.8 GRAPH COLO

RING

2. Find the chromatic number of the given graph.

EXERCISE 3.8EXERCISE 3.8

FIGURE 1 FIGURE 2

ba

d

c

e f

g h

b

a d

c

ef

g

Page 114: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.8 GRAPH COLO

RING

How can the final exams at UMP be scheduled so that no student has two exams at the same time?

Suppose that, 7 finals to be scheduled and the following pairs of course have common students.1&2, 1&3, 1&4, 1&7, 2&3, 2&4, 2&5, 2&7, 3&4, 3&6, 3&7, 4&5, 4&6, 5&6, 5&7, and 6&7

Application: Scheduling Final ExamsApplication: Scheduling Final Exams

Time Period Course

I 1, 6

II 2

III 3, 5

IV 4, 7

1

brown 2

3

7

4

6

5

red

green

blue

red

brown

green

Page 115: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.8 GRAPH COLO

RING

3. Schedule the final exams for Math 115, Math 116, Math 185, Math 195, CS 101, CS 102, CS 273, and CS 473, using the fewest number of different slots, if there are no students taking both Math 115 and CS 473, Math 116 and CS 473, both Math 195 and CS101, both Math 195 and CS 102, both Math 115 and Math 116, both Math 115 and Math 185, and both Math 185 and Math 195, but there are students in very combination of courses.

EXERCISE 3.8EXERCISE 3.8

Page 116: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

3.8 GRAPH COLO

RING

EXERCISE 3.8 : EXTRAEXERCISE 3.8 : EXTRA

PAGE : 672, 673, 674 and 675

Rosen K.H., Discrete Mathematics & Its Applications, (Seventh Edition), McGraw-Hill, 2007.

Page 117: BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS CHAPTER 3 GRAPHS SITI ZANARIAH SATARI FIST/FSKKP UMP I0910

CHAPTER 3 GRAPH

SUMMARYSUMMARY

THAT’S ALL ; THANK YOU

• A lot of problems and applications in various area can be modeled and solve using undirected or directed graph.

What NEXT?

Chapter 4: Tree