You are on page 1of 92

1

INTRODUCTION TO GRAPH-
THEORY
AND APPLICATIONS

Irith Hartman
Motivation
2

 What is the common link between the following


problems: traffic network design and cancer
research?
 Arranging marriages and scheduling flights?
 Finding cure for mental illness, computer chip
design, architectural floor planning, fighting terror
online?
 Fighting epidemics, e-commerce, designing voting
schemes, job assignment, designing electrical
networks, deciding on facility location, etc. etc. etc.
What is a graph?
3

 A set of points and lines joining these points.


 Formally: G=(V,E), V-vertices, E-edges
e6
v1
v4
v3
V2 and v3 are adjacent.
e1 e2 is incident with v2.
e2 e3
e5
v2
v5
e4
Presentations of graphs
4

v3
 Drawing e2
v4
e3

e4 e5
v5
v2
 Incidence matrix
e1 e6
v1

e1 e2 e3 e4 e5 e6
v1 1 0 0 0 0 2
Degree of a vertex,
v2 1 1 0 1 0 0
Regular graph
v3 0 1 1 0 1 0
v4 0 0 0 0 0 0 Hand shaking lemma
v5 0 0 1 1 1 0
Presentations of graphs
5

e2 v3
v4
 Adjacency matrix e3

v1 v2 v3 v4 v5 e4 e5
v5
v2
v1 2 1 0 0 0
e1 e6
v2 1 0 1 0 1 v1

v3 0 1 0 0 2

v4 0 0 0 0 0

v5 0 1 2 0 0
Directed Graphs
6

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 Graphs
7

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 3 0 0
Graphs as models
8

 Networks: transportation, roadmaps, computer,


electrical, etc.
Graphs as models
9

 Personnel
assignment
problems. (assigning
people to jobs,
arranging
weddings, finding
appropriate
roommates, etc.)
 Social networks.
Graphs as models
10

 Personnel assignment problems. (assigning people to


jobs, arranging weddings, finding appropriate
roommates, etc.)
 Social networks.
 VLSI chip design. (Planar graphs, visibility,…)
 Geometric polyhedra (Rigidity of structures,)
 Chemistry
 Biology
Graphs as models (cont.)
11

 Ecosystems (food web…)


 Scheduling and timetabling problems
 Puzzles and games
 Many others
Matching Problem
12

women men
w1 m1

w2 m2

w3 m3

w4 m4

w5 m5

Definition: A matching is a set of disjoint edges


in a graph. A matching is perfect if it meets every
vertex in the graph..
Matching Problem
13

women men

w1 m1

w2 m2

w3 m3

w4 m4

w5 m5

Is this a maximum matching?


Assignment Problem
14

workers machines

w1 1 m1
3
1
w2 2 m2
1.5
2
w3 2 m3

1.7 4
w4 m4
3
2
w5 m5

Find a minimum (maximum) cost


assignment of workers to machines
Stable Marriage Problem
15

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

W2 prefers m5 to her spouse and m5


prefers w2 to his spouse.
Applications
16

 Assigning doctors to hospitals.


 Assigning people to jobs.
 Assigning students to dormitories.
 Assigning pairs of drivers to trucks.
 Etc.
Timetabling problems
17

 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
18

 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
19

 Definition: A proper k- edge coloring of a graph


G=(V,E) is a mapping
 c: E {1,2,…,k} such that adjacent edges
receive distinct colors.
 If the maximum degree is  then clearly k ≥ 
 Theorem (Vizing): Any graph has either a
-coloring or a (+1)-coloring.
 Designing a time-table is a proper edge coloring
of a graph.
 Theorem A bipartite graph has a -coloring
Timetabling problems –
20
complications
 A limited number of classroom are available.
 If there are l lessons scheduled in a p-period
timetable, then how many rooms are needed?
 At least {l/p} rooms are needed.
 It is possible to arrange l lessons in p periods where
at most {l/p} rooms are occupied in any one period.
 More complications: teachers are not available for
every period, they need their tea breaks, etc. etc.
Connector problem
21

 Design a railway network


connecting a number of cities,
with a minimum possible
construction cost.
 Or electrical network, cable
TV, gas, etc.
Connector problem
22

 Design a railway network


connecting a number of cities,
with a minimum possible
construction cost.
 Or electrical network, cable
TV, gas, etc.
 Problem is Tractable
 A variation of it is intractable!
Connector problem: Graph-theory
23

 Definition: A tree is a connected acyclic graph.


 Connected = between any 2 vertices there is a path.
Acyclic = contains no cycles.
 Spanning = contains all the vertices in the graph.
 Connector problem: Given a weighted graph G:
Find a minimum weight spanning tree of G.
Travelling salesman problem
24

Delhi

Intractable!

Mumbai Hyderabad

Bangalore Chennai

Madurai

A salesperson begins in Bangalore, has to visit all the


cities, and return to Bangalore in a shortest possible
distance. (or time, or cost)
Travelling salesman problem-Graph
25
Theory
 Given a graph (or a directed
graph), does there exist a
cycle in the graph that contains
each vertex once? (i.e. a
Hamilton cycle)?
 Given a complete weighted
graph, find a Hamilton cycle of
minimum weight.
Revision of 1st lecture
26

 Graph (directed, weighted)


 Incidence matrix, adjacency matrix
 Degree, maximum, minimum degree
 Hand- shaking lemma
 Matching
 Bipartite graph
 Timetabling problem (k-edge coloring)
 Connector problem (Min spanning tree)
 Traveling salesman problem (Hamilton cycle)
More applications of TSP - Job
sequencing on a single machine
27

 V- jobs J1,J2,…,Jn
 E- edge (i,j) has cost Ci,j - the time required for job
Jj to be performed immediately after job Ji

C1,2 J2
J1

C1,3 C2,3

J3
Vehicle Routing
28

 Need to transport n children to m bus


stops across the city.
 There are k buses, each bus j has
capacity cj. Each km has a cost.
(time).
 Problem: Route the buses s.t. the
total cost (or time) is minimized.
 Difficult – intractable problem!
Chinese Postman Problem
29

 A postman begins in the P.O.

post office, has to


traverse all the streets,
and returns to the post
office in a shortest
possible distance.
Chinese Postman Problem
30

 A postman begins in the P.O.

post office, has to


traverse all the streets,
and returns to the post
office in a shortest
possible distance.
 Tractable!
Chinese Postman Problem- graph
31
theory
 Definition: an Euler tour is a P.O.

closed walk that traverses


all the edges in the graph.
 Problem: Does a graph
have an Euler tour?
 Easy problem…
 Problem: Find a minimum
Chinese Postman Tour.
 Tractable…
Chinese Postman Problem- another
32
application
Testing a computer program
 V – states of a program
 E – transitions between the states
 Problem: Generate input data that forces the
program to test all possible transitions.
 Another Problem: Test all pairs of consecutive
transitions… (how should we do that?)
Traffic network design problems
33

 Cities have a growth of vehicle fleets


 Good mobility and accessibility to goods, labour,
and markets permit and encourage urban
concentration.
 Good transportation is necessary for jobs, business,
basic utilities.
 Transportation usually occupies 20-40% of city’s
physical space
 Problems: Change traffic patterns to allow a more
efficient flow of transportation.
Traffic network design problem
34

 Problem 1: Given an undirected graph, orient the


edges so that the resultant graph is strongly
connected (i.e. between any 2 vertices x,y there is a
directed path from x to y).
 Can be done iff the graph contains no cut edges.
 Problem 2: Orient the graph, or add edges, s.t.
even if two (or k) edges ( or vertices) fail, it is still
strongly connected.
 Relates to the concept of connectivity of graphs.
Traffic network design problem
35

.
Orient the edges so that
the resultant graph is
strongly connected
Traffic network design problem
36

.
Orient the edges so that
the resultant graph is
strongly connected

Is it strongly connected?
Traffic network design problem
37

.
Orient the edges so that
the resultant graph is
strongly connected

Now it is!
Facility location (A problem in OR)
38

 Placing facilities that serve certain


clients with certain demands in a
way that minimizes the total cost.
 E.g., placing hospitals, police
stations in a city, warehouses that
serve shops, placement of content
distribution servers on the Internet,
etc.
 Problem is intractable
Facility location: k-median problem
39

 Given a weighted graph,


specified vertices called
clients. Need to place
facilities in k vertices in the
graph which will serve the
clients best possible. .
 Minimize the distance of a
client to each closest facility.
 Facilities also have costs.
Dominating set problem
40

 Given G=(V,E). Find a subset of vertices S s.t. every


vertex is either in S or is adjacent to at least one
vertex in S.
 Application:
 Surveillance - put radar stations to keep an eye on
strategic locations.
 Chess – min no. of queens in a chess board so that
all the pieces are covered.
 Problem is intractable!
Channel assignment
41

 V- a set of transmitters
 E – interference
 Channel assignment – assign colors
(channels) to the vertices such that
adjacent vertices (transmitters) are
assigned different colors.
Back to graphs…
42

 Definition: A proper k-coloring of a graph G=(V,E) is a


mapping c: E {1,2,…,k} such that adjacent
vertices receive distinct colors.
 Let  denote the min k s.t, G has a proper k-coloring.
 If  is the maximum degree then  ≤ +1(how?)
 An odd cycle or a complete graph has =+1.
 Finding  is an intractable problem.
Vertex coloring-example
43


2

3 3
1 3 2

2
1

2 1
Rigidity of structures
44

Not rigid

Rigid
Rigidity of structures
45

Not rigid

Rigid ?
Rigidity of structures
46

Yes!

Rigid ?
Rigidity of structures- graph model
47

r1 c1

r2 c2

r3
c3

Theorem: A rectangular framework is rigid iff


the associated bipartite graph is connected.
Rigidity in 3-space is more complicated…
Chemistry
48

 Atom – vertex
 Bond – edge
H H H
 E.g. C3H7OH
 Enumerating all
H C C C O H
isomers of a chemical
compound.
 Determining if two H H H

compounds with the


same formula are
identical.
Chemistry
49

H
O N H H

O N C H
H
H C C C H
H C N
H
H N N
H C N O

H C3H7N2O2 H H O

Graph isomorphism problem


Chemistry
50

 Enumeration of isomers (graph enumeration)


 Deciding whether two compounds are identical or
not (graph isomorphism problem)
Back to Graph Theory
51

 G1=(V1,E1) and G2=(V2,E2) are isomorphic if there


exists a 1-1 mapping f: V1 V2 s.t.
(i,j) is an edge in E1 iff (f(i),f(j)) is an edge in E2
 E.g.

Determining whether 2 graphs are


isomorphic is a difficult problem!
Biology
52

 A new field has recently emerged called bioinformatics


– application of IT and CS to molecular biology.
 DNA sequencing -
 Constructing phylogenetic (evolutionary) trees
 Competition graphs.
 Modeling ecological landscapes
 Understanding the dynamics of disease propagation
 Investigating the roles of genes and proteins,
 Etc.
DNA sequencing
53

 The building blocks of a DNA molecule are


nucleotide bases—Adenine, Guanine, Cytosine, and
Thymine (AGCT.) arranged in a sequence.
 Length of sequence is order of 3x10**9
 A special technology allows us to “see” fragments
of length 500-1200 nucleotides.
 How do we piece them together to find out the
whole sequence of the DNA?
 Difference in DNA between 2 people is less than
0.1%.
DNA sequencing-con.
54

 Construct a directed graph where


 V- fragments CTGA GACT

 E – (vi,vj) if end of fragment i


coincides with beginning of
fragment j. AAGA

 Find an Euler trail CTCT


CTAA
 Is it unique?
 Are all possible fragments there?
 Possible errors?
Models of the Spread and Control of
55
Disease through Social Networks (slides from
F. Roberts talk –DIMACS)

•Diseases are spread


through social networks. AIDS
•“Contact tracing” is an
important part of any
strategy to combat AIDS
outbreaks of infectious
diseases, whether naturally
occurring or resulting from
bioterrorist attacks.
The Model: Moving From State to State
(slides from F. Roberts talk –DIMACS)
56

Social Network = Graph


Social Network = Graph
t=0
Vertices = People Vertices = People
Edges = contact Edges = contact

Let si(t) giveLet


thesstate of vertex
i(t) give i of vertex i
the state
at time t. at time t.
Simplified Model:Simplified
Two states:
Model: Two states:
= susceptible, = infected
= susceptible, (SI Model)
= infected (SI Model)

Times are discrete: t = 0,


Times are 1, 2, …t = 0, 1, 2, …
discrete:
The Model: Moving From State to State

57
(slides from F. Roberts talk –DIMACS)
More complex models: SI,
measles
SEI, SEIR, etc.

S = susceptible, E = exposed,
I = infected, R = recovered
(or removed)

SARS
Threshold Processes
(slides from F. Roberts talk –DIMACS)
58

Irreversible k-Threshold Process: You


change your state from to at time t+1 if
at least k of your neighbors have state at
time t. You never leave state .
Disease interpretation? Infected if sufficiently
many of your neighbors are infected.
Special Case k = 1: Infected if any
of your neighbors is infected.
Irreversible 2-Threshold Process
(slides by F. Roberts DIMACS)
59

t=0 t=1
Irreversible 2-Threshold Process
(slides by F. Roberts DIMACS)
60

t=1 t=2
Irreversible 3-Threshold Process
(slides by F. Roberts DIMACS)
61
g

f
a

e b

d c

t=0
Irreversible 3-Threshold Process
(slides by F. Roberts DIMACS)
62
g g

f f
a a

b b

d c c
d
t=0 t=1
Irreversible 3-Threshold Process
(slides by F. Roberts DIMACS)
63 g
g

f f
a a

e b
e b

d c d c
t=1 t=2
Complications to Add to Model
(slides by F. Roberts DIMACS)
64

•k = 1, but you only get infected


with a certain probability.
•You are automatically cured after
you are in the infected state for d
time periods. Waiting for smallpox
•A public health authority has the vaccination, NYC, 1947

ability to “vaccinate” a certain


number of vertices, making them
immune from infection.
Biology – phylogenetic tree
65
Niche overlap graph
66

 Normal healthy environment for a species is determined by


temp., light, Ph level, moisture, etc.
 Each factor defines an interval of values
 N-dim box in n-dim space is the “ecological niche” of the
species.
 The graph G=(V,E):
V- collections of species from an eco-system
E – (I,j) in an edge iff their ecological niches overlap.
 Determine the smallest n s.t. G is an intersection graph of n-dim
boxes in n-dim space. (also called the boxicity of a graph)
 If n=1 G is called an interval graph.
Biology- example: studies on bird
67
population
 Ecological landscapes can be modeled using graphs.
 V- represents habitat patches or roosts for birds,
E - represent movement between the patches.
 Graphs help study the structural organization of a
landscape, importance of certain nodes, degree of
connectivity between them.
 These properties affect the spread of disease, the
vulnerability to disturbance of the landscape, and other
issues related to conservation
Floor planning (VLSI design)
68

 Components and connections


a
(nets) between them. a b c
 Cost of chip depends on the
area of the bounding rectangle.
 Performance and power c c b
consumption depends on length of
metal wires.
a
 Problem: Organize the
a c
components and wiring in the
plane to minimize cost and length b
of wire
Back to graphs…
69

 Definition: A planar graph K4


G=(V,E) is a graph that can
be drawn in the plane s.t. its
edges intersect only at their
ends.
 Is a graph planar?
K5, K3,3 not planar
 Tractable!
 Determine the crossing
number.
 Intractable!
VLSI application – one sided channel
70
routing
 Modules, containing terminals
 Terminals with a common label are a net.
 nets must be interconnected by horizontal & vertical
wires
 wires which belong to distinct nets may not cross at the
same layer
 change from one layer to another is done with a via
 Problem: Find a wiring which minimizes the number of
vias.
VLSI application – one sided channel
71
routing

a b c a c e d f b e a f

A B C D

modules
VLSI application – one sided channel
72
routing

a b c d c e d f b e a f

A B C D

A possible wiring with 6 vias


VLSI application – one sided channel
73
routing

a b c d c e d f b e a f

A B C D

An optimal wiring with only 3 vias


VLSI application – one sided channel
74
routing

a b c d c e d f b e a f

A B C D

Problem was solved optimally by


Edelsbrunner, Overmars, Welzl,
Hartman, Feldman (int. J. Comp.
Math. 34, 1990)
VLSI application – one sided
75
channel routing – idea of solution
Rx
 Overlapping intervals x
y
 Nested intervals Ly

 Independent intervals
 Overlapping intervals
exclude each other.
One sided channel routing – back to
76
graphs
L R 1
2
1
3
2 5 4

5 Edge (li,rj) iff li and rj exclude


each other
One sided channel routing – back to
77
graphs
L R 1
2
1
3
2 5 4

5 • Edge (li,rj) iff li and rj exclude


each other
• What is the min number of
hidden endpoints?
One sided channel routing – back to
78
graphs
L R 1
1 3
2
2 5 4

5 • Best possible??
One sided channel routing – back to
79
graphs
L R 1
2
1
3
2 5 4

4 • Find a min set of vertices that


cover all the edges of the graph.
5 • Vertex cover problem
• Theorem: (Konig) In a
bipartite graph the min size of a
vertex cover = max size of a
matching.
One sided channel routing – back to
80
graphs
L R 1
2
1
3
2 5 4

4 • Find a min set of vertices that


cover all the edges of the graph.
5 • Vertex cover problem
• Theorem: (Konig) In a
bipartite graph the min size of a
vertex cover = max size of a
matching.
One sided channel routing – back to
81
graphs
L R 1
2
1
3
2 5 4

4 • Find a min set of vertices that


cover all the edges of the graph.
5 • Vertex cover problem
• Theorem: (Konig) In a
bipartite graph the min size of a
vertex cover = max size of a
matching.
One sided channel routing –optimal
82
solution
L R 5
1
1
4
2
3

3 2

5
One sided channel routing –
83
related unsolved problems
 Solve the one-sided channel problem with multi-
point net.
 Assume the number of available tracks is constant.
 Assume “dog-legs” are allowed.
Free route to Las Vegas Problem (D.E.
84
Knuth)
 Given a finite, strongly connected network D of one-
way roads between cities, and a designated city
called Las Vegas, is it possible to erect toll booths on
these roads to satisfy the following conditions:
1. It is impossible to drive indefinitely without paying a
toll (There is no toll-free cycle)
2. It is possible to start on any road and return to your
starting point, paying only one toll (every rd is part
of a one-toll cycle)
3. There is a toll-free route from every city to Las-
Vegas
Example
85

Los Gatos

Los Angeles

Las Vegas

Las Cruces

Toll
Network flows
86

 Flows of commodities in a network.


 E.g.,flow of oil, water, through pipelines, or electricity,
phone calls, email messages, data, commodities
transported across trains, trucks, etc.
 Problems:
1. Find a max flow that can be transferred in a given
time unit.
2. Design a network with given constraints (budget,
reliability, etc.)
Network Flows
87

 A network N(s,t) is a directed graph with a source s


(production center) and sink t (market) and a
function c defined on its arcs.
 c: E R Capacity of each edge. (maximum rate
at which a commodity can be transported along it)
 Flow f: E R satisfies:
 f^+(v)=f^-(v) for all v≠ s, t
 0≤ f(a) ≤ c(a)
 Value of a flow is f^+(s)-f^-(s)
Network Flows
88

 Problem 1: Find a feasible flow of maximum value.


 Problem 1 is tractable.
Integer multicommodity flows
89

 Given k pairs of vertices


(s1,t1), (s2,t2), …, (sk,tk) and s1 d1
t1
nonnegative demands
d2
d1,…,dk s2 t2

 Problem: Find (si,ti)- flow of s3 d3


t3
value di such that the sum of d4
s4 t4
the flows on an arc does not
increase its capacity. s5
d5
t5
 Intractable even for k=2
Back to graphs…
90

 Definition: An Interval graph is …


Applications of interval graphs
91
Generalizations of interval graphs
92

 Definition: Boxicity…

You might also like