CS3000: Algorithms & Data Jonathan Ullman
Lecture 17: More Applications of Network Flow March 25, 2020
CS3000: Algorithms & Data Jonathan Ullman Lecture 17: More - - PowerPoint PPT Presentation
CS3000: Algorithms & Data Jonathan Ullman Lecture 17: More Applications of Network Flow March 25, 2020 Image Segmentation foreground background e me d I II D o.o u x Em Set of pixels n Separate image into foreground and
Lecture 17: More Applications of Network Flow March 25, 2020
Image Segmentation
background
foreground
e me
d
D
u
Set of pixels
n xEm e g middle
pixelsmore
likely
to be
foreground
Image Segmentation
4 2, 3 = 6 ()
+ 6 *
− 6 /)0
=>? 8 @AB :
Assume all values
in the graph
q of
me
9
m
externally
a
likelihood of foreground
foreground
background
i
j
Pij
Reduction to MinCut
max
8,: 6 ()
+ 6 *
− 6 /)0
=>? 8 @AB :
min
8,: 6 *)
+ 6 (0
+ 6 /)0
=>? 8 @AB :
y
Short for
Image Segmentation
D
Min
f
x
may
f x
Fon
Fa
FB bi
Pii
A DE
btv A B
am
Ea
ai E
bi
Epi
I
Reduction to MinCut
SE A
f
t C B EE B
O_0 se Aq
Solution Add
dummy nodes
s and
t to
the graph
Reduction to MinCut
edges from A to B
min
8,:
6 /)0
JKLM 8 >L :
min
8,: 6 *)
+ 6 (0
+ 6 /)0
=>? 8 @AB :
A
B
solution
yes
Replace undirected
go
no
edge Cii
ul
Ily
i
j
and j
i B
A
both
with
capacity pi
i0
0j Mandy.net
js
n
mbth
Reduction to MinCut
terms for edges from A to B
min
8,:
6 /)0
JKLM 8 >L :
min
8,: 6 *)
+ 6 (0
+ 6 /)0
=>? 8 @AB :
so
edges from
s
Iz
and t
7ft
capacity we
want
Reduction to MinCut
we’re trying to minimize min
8,: 6 *)
+ 6 (0
+ 6 /)0
JKLM 8 >L :
Replace
max
with
men
Replace
undirected edges
w
pairs of directededge
Add
dummy
nodes
St
b ax
Add
dummy edges
s
x
x e
Step 1: Transform the Input
Input G,{a,b,p} for SEG Input G’ for MINCUT
Replace
Max
with
man
Replace
undirected edges
w
pairs of directededges
Add
dummy
nodes
St
b ax
Add
dummy edges
s
x
x e
Total Time
mtn
Step 2: Receive the Output
Solve
Input G’ for MINCUT Output (A,B) for MINCUT
u
u
v x3
were the original graph
A B
is
a mmmm
sat at
in
G
T
Ine
Solve
mascot
a
A graph with
n
12 nodes
B
and
2Mt 2n edges
so 0Cmn
t.me
Step 3: Transform the Output
Output (A,B) for SEG Output (A,B) for MINCUT
Return partition
A
fu v3
B
f w
x 3
O
O
A
B
Time
n
Reduction to MinCut
Every patron
A B
corresponds
to
an
s C
at
A 0953 Bu Et3
For every
sf
we
Auss3
Bust 3
the
capacity is ftp.bi
xatg what
SEG wants to
Total Time
mn
m.nm.ae
Bottleneck is solving
minimum
at
Image Segmentation
connections inside and few outside
Mammootty
Densest
Subgraph
edges inside
070
made
Hr
Densest Subgraph
|8|
2
tt
msideA
A
F ASA
set of edges
w
both endpoints in A
ECA B
set of edges
w
DS
uses an undirectedgraph
Ds
ieesuscnooseayseiafmmiIT.es
ie
I
Add
dummy
nodes
s
t
Same transformations
as
SEG
Need to transform
the
DS
MINCUT
2 IECA A I
E
C i j
Ci j
EE
IAl
f
IEA
jtB
it
FA
ai
Effbite
cij
btw A B
usang
dummy edges
Reduction to MinCut
8
8
≥ Q and see what that implies
⇔ 2 & 2, 2 ≥ Q 2 ⇔ ΣU∈8 deg Y − & 2, 3 ≥ Q 2 ⇔ ΣU∈Z deg Y − ΣU∈: deg Y − & 2, 3 ≥ Q 2 ⇔ 2 & − ΣU∈: deg Y − & 2, 3 ≥ Q 2 ⇔ ΣU∈: deg Y + Q 2 + & 2, 3 ≤ 2 & ⇔ ΣU∈: deg Y + ΣU∈8Q + Σ\ JKLM 8 >L : 1 ≤ 2 &
If I can
ask yes
no
questions Is the DS der w
f
Em
than 8
then
I can find
the
densest
subgraph
me
Reduction to MinCut
8
8
≥ Q and see what that implies
⇔ 2 & 2, 2 ≥ Q 2 ⇔ ΣU∈8 deg Y − & 2, 3 ≥ Q 2 ⇔ ΣU∈Z deg Y − ΣU∈: deg Y − & 2, 3 ≥ Q 2 ⇔ 2 & − ΣU∈: deg Y − & 2, 3 ≥ Q 2 ⇔ ΣU∈: deg Y + Q 2 + & 2, 3 ≤ 2 & ⇔ ΣU∈: deg Y + ΣU∈8Q + Σ\ JKLM 8 >L : 1 ≤ 2 &
If I can
ask yes
no
questions Is the DS der w
f
Em
than 8
then
I can find
the
densest
subgraph
Eadegen
TEAdegcul jfdegh E.de
IECA B I
E
L
Sla
efrom
A B
3
S
v C A
t Fa
s
t Ee
L fromA to B
If
the value
is
E 21 El
then
the
subgraph
A has
2 IEEa Al
Tai
38
Reduction to MinCut
ΣU∈: deg Y + ΣU∈8 Q + Σ\ JKLM 8 >L : 1 ≤ 2 &
degg
I s
degce
Thisgraph has mmeat ELIE
if andonly if F
a
subgraph
8