Professional Documents
Culture Documents
2-Ad Hoc Networks-Graph Theory-Lecture2
2-Ad Hoc Networks-Graph Theory-Lecture2
Dr Ljiljana Simić
iNETS, RWTH Aachen University
SS2016
Important
Note:
These
course
notes
may
contain
some
copyrighted
material.
The
copyright
of
this
material
covers
its
use
in
class
and
for
educa7onal
purposes,
but
you
are
not
allowed
to
distribute
this
course
material
freely.
Under
the
code
of
appropriate
use,
please
refrain
from
uploading
the
provided
source
files
or
documents
to
any
publicly
accessible
system
outside
RWTH
Aachen
University
without
prior
permission.
1
– Graph Theory &#
Routing Fundamentals
#
ver.ces
edges
2
Graphs ↔ Networks
Graph
Ver7ces
Edges
Flow
(Network)
(Nodes)
(Arcs)
telephone
exchanges,
cables,
fiber
op.cs,
voice,
video,
communica.ons
computers,
satellites,
microwave/wireless
data
packets
radios
links
gates,
registers,
processors
circuits
wires
current
reservoirs,
pumping
hydraulic
sta7ons,
lakes
pipelines
fluid,
oil
freight,
airports,
rail
yards,
street
highways,
railbeds,
transporta7on
intersec7ons
airway
routes
vehicles,
passengers
ver.ces
edges
3
Elementary concepts
ver.ces
§ a
graph
G(V,E)
is
two
sets
of
objects
-‐
ver.ces
(or
nodes),
set
V
-‐ edges,
set
E
edges
§ a
graph
is
represented
with
dots
or
circles
(ver7ces),
joined
by
lines
(edges)
§ running
7me
of
algorithms
is
measured
in
terms
of
the
order
&
size
Directed graph
§ an
edge
e∈
E
of
a
directed
graph
is
represented
as
an
ordered
pair
(u,v),
where:
à u,
v
∈
V
à u
is
the
ini7al
vertex
and
v
is
the
terminal
vertex
à assume
that
u
≠
v
2
3
1
4
Undirected graph
§ an
edge
e∈
E
of
an
undirected
graph
is
represented
as
an
unordered
pair
(u,v)=(v,u),
where:
à u,
v
∈
V
à assume
that
u
≠
v
2
3
1
Degree of a vertex
§ in
an
undirected
graph,
degree
of
a
vertex
is
the
number
of
edges
incident
on
it
§ in
a
directed
graph,
à out
degree
of
a
vertex
is
the
number
of
edges
leaving
it
à in
degree
of
a
vertex
is
the
number
of
edges
entering
it
2 2
3 3
1 1
4 4
The
degree
of
vertex
4
is
2.
The
out
degree
of
vertex
4
is
2,
the
in
degree
of
vertex
4
is
1.
5
Weighted graph
§ a
weighted
graph
is
a
graph
for
which
each
edge
has
an
associated
weight,
usually
given
by
a
weight
func4on,
w:
E
→
R
2 2
1.2
0.5
4
2
6
0.2
3 3
1 1
9
2.1
8
4 4
3
V2
V3
1
2
3
V1
1
V6
4
4
V4
V5
1
6
Walks and paths
§ a
walk
is
an
sequence
of
nodes
(v1,
v2,...,
vL)
such
that
{(v1,
v2),
(v2,
v3),...,
(vL-‐1,
vL)}
⊆
E,
e.g.
(V2,
V3,
V6,
V5,
V3)
3
V2
V3
1
2
3
V1
1
V6
4
4
V4
V5
1
3
V2
V3
1
2
3
V1
1
V6
4
4
V4
V5
1
7
Walks and paths
§ a
cycle
is
a
walk
(v1,
v2,...,
vL)
where
v1=vL,
with
no
other
nodes
repeated
and
L>3,
e.g.
(V1,
V2,
V5,
V4,
V1)
Complete graphs
§ a
complete
graph
is
an
undirected/directed
graph
in
which
every
pair
of
ver7ces
is
adjacent
C
D C
§ 4
nodes
and
(4*3)/2
edges
§ 3
nodes
and
3*2
edges
§ V
nodes
and
V*(V-‐1)/2
edges
§ V
nodes
and
V*(V-‐1)
edges
8
Connected graphs
§ an
undirected
graph
is
connected
if
you
A B C
can
get
from
any
node
to
any
other
by
following
a
sequence
of
edges
OR
any
two
nodes
are
connected
by
a
path
D E F
Bipartite graph
§ a
bipar4te
graph
is
an
undirected
graph
G=(V,E)
in
which
V
can
be
par77oned
into
2
sets
V1
and
V2,
such
that
(u,v)
∈
E
implies
either:
u
∈
V1
and
v
∈
V2
or
V1
V2
v
∈
V1
and
u
∈
V2.
u1
v1
u2
v2
u3
v3
u4
9
Trees
Trees
Let
G
=
(V,
E
)
be
an
undirected
graph.
à
the
following
statements
are
equivalent:
A
5.
G
is
acyclic,
but
if
any
edge
is
added
to
E,
the
resul7ng
graph
contains
a
cycle
6.
G
is
acyclic,
and
|E|
=
|V|
-‐1
F
10
Spanning Tree
§ a
tree
(T)
is
said
to
span
G
=
(V,E)
if
T
=
(V,E’)
and
E’
⊆
E
V6
V4
V5
V1
T1
V2
V3
G V4
V5
V6
V1
T2
V4
V5
Applications of Trees
§ unicast
rou7ng
(one-‐to-‐one)
→
shortest
path
spanning
tree
§ mul7cast
rou7ng
(one-‐to-‐several)
§ maximum
probability
of
reliable
one-‐to-‐all
communica7ons
→
maximum-‐weight
spanning
tree
§ load
balancing
→
degree-‐constrained
spanning
tree
11
Minimum Spanning Tree
§ given
connected
graph
G
with
real-‐valued
edge
weights
ce,
a
Minimum
Spanning
Tree
(MST)
is
a
spanning
tree
of
G
whose
sum
of
edge
weights
is
minimized
3
2
24
3
2
4
4
1
1
23
9
9
6
18
6
6
6
5
4
5
4
16
11
11
8
5
8
5
7
7
10
14
7
21
8
7
8
Applications of MST
MST
is
central
combinatorial
problem
with
diverse
applica.ons
§ designing
physical
networks
§ telephone,
electrical,
hydraulic,
TV
cable,
computer,
road
12
MST computation
Prim’s Algorithm
§ select
an
arbitrary
node
as
the
ini.al
tree
(T)
§ augment
T
in
an
itera.ve
fashion
by
adding
the
outgoing
edge
(u,v)
(i.e.
u
∈
T
and
v
∈
G-‐T
)
with
minimum
cost
(i.e.
weight)
§ the
algorithm
stops
aNer
|V|
-‐
1
itera7ons
§ computa7onal
complexity
=
O
(|V|2)
Kruskal’s Algorithm
§ select
the
edge
e
∈
E
of
minimum
weight
→
E’
=
{e}
§ con7nue
to
add
the
edge
e
∈
E
–
E’
of
minimum
weight
that
when
added
to
E’,
does
not
form
a
cycle
§ computa7onal
complexity
=
O
(|E|log|E|)
V3
V3
V2
3
V2
3
V2
3
V3
1
1
1
2
1
1
1
V1
V1
V1
V6
1
1
V5
V4
V5
V4
V5
ANer the 3rd itera7on ANer the 4th itera7on ANer the 5th itera7on
13
Kruskal’s Algorithm (example)
V2
3
V2
V3
V3
V2
1
1
1
2
V1
Algorithm
3
V6
starts
1
V1
1
V1
V2
V3
V4
4
1
1
4
V4
V5
V1
1
V5
ANer
the
1st
1
itera7on
ANer
the
2nd
itera7on
V5
V2
V3
V2
3
V3
1
1
2
2
1
1
V1
V1
V6
V6
1
1
V4
V5
V4
V5
ANer
the
3rd
itera7on
ANer
the
4th
itera7on
§ starts
with
one
or
more
fragments
consis7ng
of
single
nodes
§ each
fragment
selects
its
minimum
weight
outgoing
edge
§ using
control
messaging
fragments
coordinate
to
merge
with
a
neighbouring
fragment
over
its
minimum
weight
outgoing
edge
§ O(|V|log|V|)
7me,
provided
that
the
edge
weights
are
unique
§ if
weights
not
unique,
algorithm
s7ll
works
by
using
the
nodes
IDs
to
break
7es
between
edges
with
equal
weight
§ requires
O(|V|log|V|)
+
|E|)
message
overhead
14
Distributed MST (GHS) Algorithm (example)
V2
1
V3
V2
1
V3
Zero
level
fragments
1
2
3
4
1
2
3
4
V6
V7
5
5
V1
V7
4
5
V1
4
5
V6
3
2
3
2
V4
6
V5
V4
6
V5
V1
4
5
V6
3
2
V4
6
V5
2 2
2
2
6
2
6
2
3 1 3
1 5
3 1 5
2
2
2
4 4
4
Shortest
Path
Spanning
Tree
Graph
Minimum
Spanning
Tree
rooted
at
vertex
1
§ note that SPST is not the same as the MST
15
Routing
Applica7on
§ main
func7on
of
the
Network
layer
Transport
Network
§ op.mality
principle:
Data
Link
“if
node
J
is
on
op7mal
path
IàK,
then
op7mal
path
JàK
is
along
same
route”
Physical
§ set
of
op.mal
routes
from
all
sources
to
a
given
des.na.on
form
a
sink
tree
rooted
at
the
des.na.on
§ goal
of
all
rou7ng
algorithms
is
to
discover
and
use
the
sink
trees
for
all
des7na7on
nodes
in
the
network
2
24
3
2
24
3
4
1
23
9
1
4
23
9
6
18
6
18
6
6
(shortest
path)
5
4
5
4
16
5
11
16
11
sink
tree
for
8
8
5
14
7
7
des.na.on
10
10
14
node
3
7
21
8
7
21
8
16
Dijkstra’s Algorithm
§ each
node
in
the
network
(graph)
is
labeled
with
its
distance
from
the
source
node
along
the
best
known
path
§ ini7ally
no
paths
are
known:
all
nodes
labeled
with
(∞,-‐)
§ as
algorithm
runs
and
paths
are
found,
labels
change
to
reflect
beker
paths
§ once
shortest
possible
path
from
source
to
a
node
is
found,
its
label
changes
from
tenta4ve
to
permanent
17
Dijkstra’s Algorithm (example)
1
§ assume:
V2
V3
-‐
V1
is
s
(source
node)
1
2
3
4
-‐
Dv
=
distance
from
node
s
to
node
v
5
V1
V7
V6
§ if
there
is
no
edge
connec7ng
two
4
4
nodes
x
and
y,
then
w(x,y)
=
∞
3
2
V4 6 V5
V’
=
{1}
(1,
V1)
1
(∞,
V1)
V2
V3
4
1
2
3
5
V1
(∞,
V1)
V7
V6
4
4
(∞,
V1)
3
2
V4
6
V5
(∞,
V1)
(3,
V1)
18
Dijkstra’s Algorithm (example)
1
§ find
temporary
node
with
smallest
label
in
V2
V3
graph
and
make
it
permanent
1
2
3
4
à
becomes
new
working
node
5
V1
V7
V6
§ examine
all
nodes
adjacent
to
working
4
4
node,
relabel
if
path
to
source
node
via
3
2
working
node
shorter
V4
6
V5
19
Dijkstra’s Algorithm (example)
1
§ find
temporary
node
with
smallest
label
in
V2
V3
graph
and
make
it
permanent
1
2
3
4
à
becomes
new
working
node
5
V1
V7
V6
§ examine
all
nodes
adjacent
to
working
4
4
node,
relabel
if
path
to
source
node
via
3
2
working
node
shorter
V4
6
V5
20
Dijkstra’s Algorithm (example)
1
§ find
temporary
node
with
smallest
label
in
V2
V3
graph
and
make
it
permanent
1
2
3
4
à
becomes
new
working
node
5
V1
V7
V6
§ examine
all
nodes
adjacent
to
working
4
4
node,
relabel
if
path
to
source
node
via
3
2
working
node
shorter
V4
6
V5
21
Dijkstra’s Algorithm (example)
1
§ note
that
the
tree
computed
is
a
shortest
V2
V3
path
spanning
tree
rooted
at
V1,
1
2
3
4
NOT
a
minimum
weight
spanning
tree
5
V1
V7
V6
(shown
below)
4
4
1
3
2
V2
V3
1
2
3
4
V4
6
V5
5
V1
V7
V6
4
4
3
2
V4
6
V5
Bellman-Ford Algorithm
§ find
the
shortest
walk
from
a
source
node
s
to
an
arbitrary
des7na7on
node
v,
subject
to
the
constraints
that
the
walk
consist
of
at
most
h
hops
and
goes
through
node
v
only
once
22
Bellman-Ford Algorithm (pseudocode)
%assume
s
to
be
the
root
(source)
node
Dv-‐1
=
∞
∀
v∈
V;
Ds0
=
0
and
Dv0
=
∞
∀
v
≠
s,
v
∈
V
;
h
=
0;
un.l
(Dvh
=
Dvh-‐1
∀
v∈
V
)
or
(h
=
|V|)
do
h
=
h
+
1;
for
v∈
V
do
Dvh
=
min{Duh-‐1
+
w(u,v)}
∀
u∈
V;
endFor
endUn.l
23
Bellman-Ford Algorithm (example)
D2h-‐1=∞
D3h-‐1=∞
1
V2
V3
4
D
un.l
(Dvh
=
Dvh-‐1
∀
v∈
V
)
or
(h
=
|V|)
do
1
2
3
6 =∞
h-‐1
h
=
h
+
1;
D1h-‐1=0
5
V1
D7h-‐1=∞
V7
V6
for
v∈
V
do
4
4
Dvh
=
min{Duh-‐1
+
w(u,v)}
∀
u∈
V;
3
2
endFor
V5
D5h-‐1=∞
endUn.l
D4h-‐1=∞
V4
6
24
Bellman-Ford Algorithm (example)
D2h-‐1=1
D3h-‐1=2
1
V2
V3
4
D
un.l
(Dvh
=
Dvh-‐1
∀
v∈
V
)
or
(h
=
|V|)
do
1
2
3
6 =∞
h-‐1
h
=
h
+
1;
D1h-‐1=0
5
V1
D7h-‐1=3
V7
V6
for
v∈
V
do
4
4
Dvh
=
min{Duh-‐1
+
w(u,v)}
∀
u∈
V;
3
2
endFor
V5
D5h-‐1=9
endUn.l
D4h-‐1=3
V4
6
25
Floyd-Warshall Algorithm
§ find
the
shortest
path
between
all
ordered
pairs
of
nodes
(s,v),
{s,v}∈
V
§ each
itera7on
yields
the
path
with
the
shortest
weight
between
all
pairs
of
nodes
under
the
constraint
that
only
nodes
{1,2,…n},
n
∈
|V|,
can
be
used
as
intermediary
nodes
on
the
computed
paths
§ algorithm
completes
in
O(|V|3)
7me
26
Floyd-Warshall Algorithm (example)
V2
D
=
W
2
for
u
=
1
to
|V
|
do
2
2
8
for
s
=
1
to
|V
|
do
6
for
v
=
1
to
|V
|
do
V1
V3
1
4
Ds,v
=
min{Ds,v
,
Ds,u+
Wu,v}
endFor
4
3
1
endFor
3
V4
1
V5
endFor
5
V1
V2
V3
V4
V5
" 0 2 4 ∞ 3 % V1
$ '
$ 2 0 8 ∞ 1 ' V2
D0 = $ 6 2 0 4 3 ' V3
$ 1 ∞ ∞ 0 5 '
$ ' V4
$# ∞ ∞ ∞ 1 0 '& V5
V1
V2
V3
V4
V5
V1
V2
V3
V4
V5
" 0 2 4 3 % V1
" % V1
$
∞
' 0 2 4 ∞ 3
$ '
$ 2 0 8 ∞ 1 ' V2
$ 2 0 8 ∞ 1 '
V2
D0 = $ 6 2 0 4 3 ' V3
D1 = $ 6 2 0 4 3 ' V3
$ 1 0 5 ' $ '
$
∞ ∞
' V4
1 3 5 0 4 V4
$ '
$# ∞ ∞ ∞ 1 0 '& V5
$# ∞ ∞ ∞ 1 0 '& V5
27
Floyd-Warshall Algorithm (example)
" % "
$
0 2 4 ∞ 3
' 0 2 4 8 3 %
$ '
$ 2 0 6 ∞ 1 ' $ 2 0 6 10 1 '
D2 = $ 4 2 0 4 3 ' D3 = $ 4 2 0 4 3 '
$ 1 3 5 0 4 ' $ 1 3 5 0 4 '
$ ' $ '
$# ∞ ∞ ∞ 1 0 '& $# ∞ ∞ ∞ 1 0 '
&
! ! $
0 2 4 8 3 $ #
0 2 4 4 3
&
# &
# 2 0 6 10 1 & # 2 0 6 2 1 &
D4 = # 4 2 0 4 3 & D5 = # 4 2 0 4 3 &
# 1 3 5 0 4 & # 1 3 5 0 4 &
# & # &
#" 2 4 6 1 0 & #" 2 4 6 1 0 &%
%
Distributed Asynchronous#
Shortest Path Algorithms
§ each
node
computes
the
path
with
the
shortest
weight
to
every
network
node
§ no
centralized
computa.on
§ as
for
the
distributed
MST
algorithm
(GHS),
control
messaging
is
required
for
distributed
computa7on
§ asynchronous
means
here
that
there
is
no
requirement
of
inter-‐node
synchroniza.on
for
the
computa7on
performed
at
each
node
or
the
exchange
of
messages
between
nodes
28
Link-State vs. Distance Vector
Link-state routing
§ each node has complete network picture (topology, link costs)
29
Distance vector routing
§ each
node
knows
the
links
to
its
neighbours
§ does
NOT
flood
this
informa7on
to
the
whole
network
§ nodes
update
their
idea
of
the
best
path
using
informa7on
from
their
neighbours
§ en.re topology knowledge must be maintained at each node
§ flooding
of
the
link
state
informa7on
allows
for
7mely
dissemina7on
of
the
topology
as
perceived
by
each
node
§ each
node
typically
has
accurate
informa7on
to
be
able
to
compute
the
shortest
paths
30
Distributed Bellman-Ford Algorithm
§ assume
G
contains
only
cycles
of
non-‐nega7ve
weight,
if
(u,v)
∈
E,
then
so
is
(v,u)
31
Distributed Bellman-Ford Algorithm (example)
1
C
Ini7al
Ds,V
B
7
s
A
B
C
D
E
A
0
7
∞
∞
1
A
8
2
B
7
0
1
∞
8
1
C
∞
1
0
2
∞
E
D
D
∞
∞
2
0
2
2
E
1
8
∞
2
0
Ds,V
1
B
C
A
B
C
D
E
s
7
A
0
7
∞
∞
1
A
8
2
B
7
0
1
∞
8
C
∞
1
0
2
∞
1
D
∞
∞
2
0
2
E
D
E
1
8
4
2
0
2
E
receives
D’s
routes
and
updates
its
Ds,V
32
Distributed Bellman-Ford Algorithm (example)
A’s
rou7ng
table
1
B
C
Des7na7on
Next
Hop
Distance
7
B
B
7
A
8
2
C
E
5
D
E
3
1
E
E
1
E
D
2
1
E’s
rou7ng
table
B
C
7
Des7na7on
Next
Hop
Distance
A
A
1
A
8
2
B
B
8
C
D
4
1
D
D
2
E
D
2
§ entries
in
the
rou.ng
table
are
deleted
if
they
are
too
old,
i.e.
they
are
not
“refreshed”
within
certain
7me
interval
by
the
recep7on
of
a
rou7ng
table
33
Link Failure
B
E
C
A
Link Failure B
E
C
A
34
Count-to-Infinity Problem
example:
routers
working
in
stable
state
A
B
C
D
E
(A,1)
(A,2)
(A,3)
Count-to-Infinity Problem
example:
link
from
A
to
B
fails
A
B
C
D
E
(A,3)
(A,2)
(A,3)
updated informa7on
35
Count-to-Infinity Problem
ANer
2
exchanges
of
updates
(A,4)
(A,3)
(A,4)
A
B
(A,5)
C
(A,4)
D
(A,5)
E
A
B
(A,5)
C
(A,6)
D
(A,5)
E
Count-to-Infinity Problem
ANer
5
exchanges
of
updates
(A,6)
(A,7)
(A,6)
A
B
(A,7)
C
(A,6)
D
(A,7)
E
36
Split Horizon with Poisoned Reverse
§ algorithm
used
to
avoid
(not
always)
count-‐to-‐infinity
problem
§ if
A
routes
to
C
via
B,
then
A
tells
B
that
its
distance
to
C
is
∞
A
B
C
(C,∞)
B will not route to C via A if the link B to C fails
§ core
of
the
problem
is
that
when
X
tells
Y
that
D
it
has
a
path
somewhere,
Y
has
no
way
of
knowing
whether
it
is
itself
on
that
path!
37
Graph Theory Addendum#
“The Stable Marriage Problem”
38
The Stable Marriage Problem
Mark
Ann
§ the
problem
and
the
solu7on
can
be
represented
as
a
John
Lisa
bipar.te
graph
Jack
Helen
Bob Marge
39
The Stable Marriage Problem
Men Women
John Lisa
Jack Helen
Bob Marge
40
Matchmaker, Make Me A Match!
Gale-‐Shapley
Algorithm
§ all
people
begin
unengaged
§ while
there
are
unengaged
men,
each
proposes
un7l
a
woman
accepts
§ unengaged
women
accept
1st
proposal
they
get
§ if
an
engaged
woman
receives
a
proposal
she
likes
beper,
she
breaks
old
engagement
and
accepts
new
proposal;
dumped
man
begins
proposing
where
he
leN
off
Men’s
Preference
List
Women’s
Preference
List
Man
1st
2nd
3rd
4th
5th
Woman
1st
2nd
3rd
4th
5th
Rick
Anne
Eva
Ina
Kate
Maria
Eva
Vlad
Rick
Sam
Ulrich
Tim
Sam
Ina
Anne
Eva
Maria
Kate
Anne
Tim
Sam
Ulrich
Rick
Vlad
Tim
Anne
Kate
Maria
Ina
Eva
Maria
Sam
Tim
Ulrich
Vlad
Rick
Ulrich
Eva
Ina
Maria
Anne
Kate
Ina
Rick
Vlad
Ulrich
Tim
Sam
Vlad
Anne
Ina
Eva
Kate
Maria
Kate
Ulrich
Sam
Vlad
Tim
Rick
Gale-Shapley Algorithm
Is
resul7ng
G-‐S
matching
stable?
Tim
Eeva
Anne
Maria
Eeva
Ulrich
Tim
Vlad
perfect
stable
matching
(men
propose)
Ulrich
Anne
Eeva
Maria
Anne
Tim
Ulrich
Vlad
Reference:
The
Stable
Marriage
Problem:
Structure
and
Algorithms
(Founda7ons
of
Compu7ng)
by
Dan
Gusfield
and
Robert
Irving,
MIT
Press,
1989.
41
Gale-Shapley Algorithm
Results
of
G-‐S
algorithm
are
always
stable
§ it
requires
two
people
of
opposite
sex
in
different
couples
to
break
up
a
marriage
§ if
a
man
wants
to
leave
for
another
woman,
then
he
already
proposed
to
her
and
she
rejected
him,
so
she
won’t
leave
her
husband
for
him
Tim
Eeva
Anne
Maria
Eeva
Ulrich
Tim
Vlad
perfect
stable
matching
(men
propose)
Ulrich
Anne
Eeva
Maria
Anne
Tim
Ulrich
Vlad
Reference:
The
Stable
Marriage
Problem:
Structure
and
Algorithms
(Founda7ons
of
Compu7ng)
by
Dan
Gusfield
and
Robert
Irving,
MIT
Press,
1989.
Gale-Shapley Algorithm
Results
of
G-‐S
algorithm
are
always
stable
§ it
requires
two
people
of
opposite
sex
in
different
couples
to
break
up
a
marriage
§ if
a
man
wants
to
leave
for
another
woman,
then
he
already
proposed
to
her
and
she
rejected
him,
so
she
won’t
leave
her
husband
for
him
Tim
Eeva
Anne
Maria
Eeva
Ulrich
Tim
Vlad
perfect
stable
matching
(women
propose)
Ulrich
Anne
Eeva
Maria
Anne
Tim
Ulrich
Vlad
Reference:
The
Stable
Marriage
Problem:
Structure
and
Algorithms
(Founda7ons
of
Compu7ng)
by
Dan
Gusfield
and
Robert
Irving,
MIT
Press,
1989.
42
Gale-Shapley Algorithm
What
happens
when
men
do
the
proposing?
§ who
is
beker
off
–
men
or
women?
Reference:
The
Stable
Marriage
Problem:
Structure
and
Algorithms
(Founda7ons
of
Compu7ng)
by
Dan
Gusfield
and
Robert
Irving,
MIT
Press,
1989.
Gale-Shapley Algorithm
What
happens
when
men
do
the
proposing?
§ each
man
has
the
best
partner
he
can
have
in
any
stable
marriage
§ each
woman
has
the
worst
partner
she
can
have
in
any
stable
marriage
§ note
that
G-‐S
always
produces
same
stable
marriage
i.e.
order
of
proposals
is
irrelevant
Reference:
The
Stable
Marriage
Problem:
Structure
and
Algorithms
(Founda7ons
of
Compu7ng)
by
Dan
Gusfield
and
Robert
Irving,
MIT
Press,
1989.
43
Gale-Shapley Algorithm
Moral
of
the
story
…
§ historically,
men
propose
to
women
-‐
why?
§ guys:
propose
early
and
oNen
§ single
ladies:
ask
out
the
guys!
Reference:
The
Stable
Marriage
Problem:
Structure
and
Algorithms
(Founda7ons
of
Compu7ng)
by
Dan
Gusfield
and
Robert
Irving,
MIT
Press,
1989.
44