Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Outline
eE
Undirected Graph
An undirected graph
is defined as a set of
G
=
(
V
,
E
)
nodes (vertices V) and a set of undirected edges E that
connect the nodes.
Assigning each edge
a weight , the graph
becomes an undirected weighted graph.
2
2
1
s
3
2
2
2
we
Directed Graph
o A directed graph is defined as a set of nodes (vertices V) and
a set of ordered set of vertices or directed edges E that
connect the nodes
G = (V , E )
e' = (v, u)
e = (u, v)
2
1
s
2
2
1
3
3
2
2
2
2
t
C E such that
Theorem:
oIn graph G, the maximum source-to-sink
flow possible is equal to the capacity of
the minimum cut in G.
o(L. R. Foulds, Graph Theory Applications,
1992 Springer-Verlag New York Inc.,
247-248)
Some Concepts
Ford-Fulkerson Algorithm
Push-Relabel Algorithm
New Algorithm by Boykov, etc.
Ford-Fulkerson Algorithm
Main Operation
Starting from zero flow, increase the
flow gradually by finding a path from s
to t along which more flow can be
sent, until a max-flow is achieved
Ford-Fulkerson Algorithm
1/2
t
1/3
1/2
0/2
0/2
Ford-Fulkerson Algorithm
0/2
0/2
0/1
s
0/2
1
t
0/3
2
2
(d)
f=0
2
1
2
2
2
(b)
f=1
1
1
1/2
1
1
t
1
f=3
2/2
1/1
t
2
(c)
1
(e)
1
t
f=3
0/2
(a)
2
1
0/2
f=2
1/3
2/2
1/2
1/2
(f)
1
s
2
2
2
1
1
1
t
1
Special Case
As in some applications only undirected
2
2
1
s
3
2
2
2
(a)
1
s
2
2
1
3
3
2
2
2
(b)
2
t
Algorithm Framework
The
basic
Ford-Fulkerson
algorithm
for
each
edge
(u, v) E
do
f (u, v) 0
f (v, u ) 0
while
there
exists
a
path
P
from
s
to
t
in
the
residual
network
Gf
do
cf
(P)
min{cf
(u,
v
):
(u,
v)
is
on
P}
for
each
edge
(u,
v)
in
P
do
f (u, v) f (u, v) + c f ( P)
f (v, u ) f (u, v)
v1
200
1
s
200
v2
t
200
Push-Relabel Algorithm
Ini$alize-Preow
(G,
s)
for
each
vertex
u V
do
e[u ] 0
h( s ) V
do
f [ v, u ] 0
f [u, v] 0
u Adj (s)
f [ s, u ] c ( s, u )
f (u, s) c( s, u )
h[u ] 0
(u, v) E
e[u ] c( s, u )
e[ s] e[ s] c( s, u )
Push
(u,
v)
Applied
when:
u
is
overowing,
AcDon:
Push
d
d f (u , v) min(e[u ], c f (u , v))
f [u , v] f [u , v] + d f (u , v)
f [v, u ] f [u , v]
e[u ] e[u ] d f (u , v)
e[v] e[v] + d f (u , v)
Relable
(u)
Applied
when:
u
is
overowing
and
for
all
v V
such that
Generic-Push-Relabel (G)
o Initialize-Preflow (G, s)
while there exists an applicable push or
relabel operation do
select an applicable push or relabel
operation and perform it
h=1
e=1
0/2
0/2
0/1
s
h=6
e=-3
s
0/3
0/2
h=0
e=0
3
2
h=0
e=1
h=6
e=-3
s
h=1
e=1-1=0
2
h=0
e=0
Initial
t
h=0
f=0
Push
2
h=0
e=0
t
h=0
f=0
h=6
e=-3
s
2
2
h=1
e=3
1
1
1
2
2
2
h=1
e=0
t
h=0
f=0
h=0
e=0
Push
h=1
e=0
t
h=0
f=0
h=0
e=0+1+2=3
h=0
e=0
2-1=1
3-2=1
Relabel
h=0
e=0
h=1
e=2-2=0
h=6
e=-3
s
h=0
e=0
h=0
e=2
2
h=1
e=2
0/2
h=6
e=-3
s
0/2
h=0
e=0
h=0
e=0
h=0
e=0
Relabel
t
h=0
f=0
h=1
e=0
h=6
e=-3
s
h=1
e=3-2=1
1
1
1
1
h=1+2=3
e=1
2
2
h=1
e=0
h=6
e=-3
s
1
1
Push
t
2
h=0
e=0
h=0
f=2
h=2
e=0+1=1
1
1
h=6
e=-3
s
Push
t
2
2
h=3
e=0
h=0
f=2
h=6
e=-3
s
h=2
e=1-1=0
2
1+1=2
2
2
h=0
e=0
Push
t
2-1=1
2
h=1
e=0+1=1
h=0
f=2
h=0
e=0
h=0
f=2
h=0
e=0
h=1
e=0
h=1
e=0
h=2
e=1-1=0
1
1
h=0
e=0
h=1
e=0+1=1 1+1=2
h=6
e=-3
s
Relabel
Relabel
t
h=3
e=1-1=0 2-1=1
2
h=1
e=0
h=1
e=0
h=1+1=2
e=1
h=0
f=0+2=2
h=6
e=-3
s
h=0
e=0
h=1
e=0
Push
h=2
e=0
h=0
f=2
h=3
e=0
h=6
e=-3
s
h=6
e=-3
s
1
2-1=1
h=0
e=0+1=1
h=3
e=0
h=2
e=0
1
1
h=3
e=0
h=2
e=0
2
2
1
h=1
e=0
Push
t
1
1
h=0
f=2
h=1+0=1
e=1
Relabel
t
h=1
e=0
h=0
f=2
h=6
e=-3
s
h=0
2-1=1 f=2+1=3
h=1
e=1-1=0
h=2
e=0
1
1
2
1
1
Finalize
t
1
1
2
h=1
e=0
Push
t
h=1
e=1-1=0
h=6
e=-3
s
2
2
h=3
e=0
h=2
e=0
h=1
e=0
h=0
f=3
O(V 2 E )
Cost of Segmentation
E ( A) = R( A) + B( A)
R( A) = R p ( Ap )
pP
B( A) =
{ p , q}
( Ap , Aq )
1 Ap Aq
( Ap , Aq ) =
0 Ap = Aq
pP { p , q}N
Graph Construction
Edge
Weight
Condition
n-link {p, q}
B{p, q}
{p, q}N
t-link {p, s}
Rp (bkg)
pP, pOUB
pO
pB
Rp (obj)
pP, pOUB
pO
pB
t-link {p, t}
n-link Construction
( I p I q ) 2
1
B{ p ,q} exp
2 2 dist ( p, q)
t-link Construction
Rp(obj) = ln
Pr(Ip|O )
K = 1 + max B{ p ,q}
pP
q:{ p ,q}N
Rp(bkg) = ln
Pr(Ip|B )
EsDmated
Background
Intensity
DistribuDon
Based
on
Background
Seeds
0.035
0.03
0.025
0.02
0.015
0.01
0.005
50
100
150
200
250
300
EsDmated
Object
Intensity
DistribuDon
Based
on
Background
Seeds
Experimental Data
Reference
Yuri. Boykov and Marie-Pierre Jolly, Interactive Graph Cuts for Optimal Boundary & Regiion Segmentation of
Objects in N-D Images, In Proceeding of International Conference on Computer Vision, Volume I, 105-112, July
2001
Yuri. Boykov and Vladimir Kolmogorov, An Experiment Comparison of Min-Cut / Max-Flow Algorithms for Energy
Minimization in Vision, IEEE Transactions on PAMI, 26 (9): 1124-1137, September 2004
Yuri. Boykov and Vladimir Kolmogorov, Computing Geodesic and Minimal Surfaces via Graph Cuts, In
Proceeding of International Conference on Computer Vision, Volume II, 26-33, October 2003
Vladimir Kolmogorov and Ramin Zabih, What Energy Functions can be Minimized via Graph Cuts?, IEEE
Transactions on PAMI, 26 (2): 147-159, February 2004
Y. Boykov, O. Veksler, and R. Zabih, Fast Approximate Energy Minimization via Graph Cuts, IEEE Transactions on
PAMI, 23 (11): 1222-1239, November 2004
Sudipta Sinha, Graph Cut Algorithms in Vision, Graphics and Machine learning, An Integrated Paper, UNC
Chapel Hill, November 2004
Yuri Boykov and Olga Veksler, Graph Cuts in Vision and Graphics: Theories and Applications, Chapter 5 of The
Handbook of Mathematical Models in Computer Vision, 79-96, Springer, 2005
Thomas Cormen, Charles Leiserson, Ronald Rivest and Clifford Stein, Maximum Flow, Chapter 26 of Introduction
to algorithms, second edition, 643-698, McGraw-Hill, 2005
L. R. Floulds, An Introduction to Transportation Networks, Section 12.5.3 of Graph Theory Applications, 246-256,
Springer, 1992
E. A. Dinic, Algorithm for Solution of a Problem of Maximum Flow in Networks with Power Estimation, Soviet Math.
Dokl., 11:12771280, 1970
Andrew V. Goldberg and Robert E. Tarjan, A New Approach to the Maximum-Flow Problem, Journal of the
Association for Computing Machinery, 35(4):921940, October 1988