Lecture-1
Lecture-1
GRAPH-THEORY
A Rules
1.
B D 2.
C
Your solution
4
Can’t seem to do it .3
4 6.1 Introduction to Graphs
Konigsberg Bridge th
(8 bridge)
5
Map Graph
A
B
C
River
Island
Island
B C
Other examples:
Electrical eng.•
Biochemistry•
Music Computer science•
Physics•
Applications in computer Science (1)
15
But where
Facebook is based in
graph theory
Applications in computer Science (4)
18
Google Maps:
Graph Operations (1)
21
Basic Operations
Graph Operations (2)
1 1 3
3
5 4 5 4
Presentations of graphs
29
Drawing v3
e2
v4
e3
e5
Incidence matrix v2
e4 v5
e1 e6
v1
e1 e2 e3 e4 e5 e6
v1 1 0 0 0 0 2
v2 1 1 0 1 0 0
v3 0 1 1 0 1 0
v4 0 0 0 0 0 0
v5 0 0 1 1 1 0
Presentations of graphs
30
Adjacency matrix
e2 v3
v1 v2 v3 v4 v5 v4
v1 2 1 0 0 0 e3
v2 1 0 1 0 1 e4 e5
v5
v2
v3 0 1 0 0 2
e1 e6
v1
v4 0 0 0 0 0
v5 0 1 2 0 0
Directed Graphs
31
e2 v3
v4
Adjacency matrix e3
v1 v2 v3 v4 v5 e4 e5
v5
v2
v1 1 0 0 0 0
e1 e6
v2 1 0 1 0 0 v1
v3 0 0 0 0 1
v4 0 0 0 0 0
v5 0 1 1 0 0
Weighted Directed Graphs
32
2 v3
v4
Adjacency matrix 2
5
v1 v2 v3 v4 v5 3 v5
v2
v1 3 0 0 0 0
1 3
v2 1 0 2 0 0 v1
v3 0 0 0 0 2
v4 0 0 0 0 0
v5 0 3 5 0 0
Graphs as models
33
Personnel
assignment
problems. (assigning
people to jobs,
arranging
weddings, finding
appropriate
roommates, etc.)
Social networks.
Graphs as models
35
women men
w1 m1
w2 m2
w3 m3
w4 m4
w5 m5
women men
w1 m1
w2 m2
w3 m3
w4 m4
w5 m5
workers machines
w1 1 m1
3
1
w2 2 m2
1.5
2
w3 2 m3
2 1
1.7 4
w4 m4
3
2
w5 m5
women men
w1 1 m1
1
1 Does there exist a
w2 2 m2 stable marriage?
1.5
2
w3 2 m3
1.7 4
w4 m4
3
2
w5 m5
m teachers, n classes.
T1 C1
Teacher i is required to teach
class j for Pij periods. T2 C2
In a given period a teacher can
be in at most 1 class, and a class C3
can have at most 1 teacher.
Design a timetable with
minimum no. of periods.
Cn
Tractable!
Tm
Timetabling problems
43
m teachers, n classes.
T1 C1
Teacher i is required to teach
class j for Pij periods. T2 C2
In a given period a teacher can
be in at most 1 class, and a class C3
can have at most 1 teacher.
Design a timetable with
minimum no. of periods.
Cn
Tractable!
Properly color the edges of G Tm
with as few colors as possible.
Edge coloring of graphs
44
Lahore
Intractable!
Faisalabad Hyderabad
Karachi Islamabad
Peshawar