Professional Documents
Culture Documents
KLexample
KLexample
a b Given:
4 1 2 Initial weighted graph G with
2 V(G) = { a, b, c, d, e, f }
2 c d
3 4 1
6 Start with any partition of
e f
V(G) into X and Y, say
X = { a, c, e }
Y = { b, d, f }
3 Compute the gain values of moving
a b
1
node x to the others set:
4 2
2
2 c d Dx = Ex - Ix
4
Ex = cost of edges connecting node x
3 1
6
with the other group (extra)
e f Ix = cost of edges connecting node x
within its own group (intra)
cut-size = 3+1+2+4+6 = 16
Da = Ea Ia = 3 (= 3 4 2)
X = { a, c, e } Dc = Ec Ic = 0 (= 1 + 2 + 4 4 3)
Y = { b, d, f } De = Ee Ie = + 1 (= 6 2 3)
Db = Eb Ib = + 2 (= 3 + 1 2)
Dd = Ed Id = 1 (= 2 2 1)
Df = Ef If = + 9 (= 4 + 6 1)
3
a b Cost saving when exchanging a and b is
4 1 2 essentially Da + Db
2
2 c d However, the cost saving 3 of the direct
3 4 1 edge was counted twice. But this edge
6 still connects the two groups
e f
X = { a, c, e } Da = Ea Ia = 3 (= 3 4 2)
Y = { b, d, f } Db = Eb Ib = + 2 (= 3 + 1 2)
gab = Da + Db 2cab = 7 (= 3 + 2 2.3)
3 Da = 3 Db = +2
a b
Dc = 0 Dd = 1
4 1 2
2
De = +1 Df = +9
2 c d Compute all the gains
3 4 1
gab = Da + Db 2cab = 3 + 2 23= 7
6
e f gad = Da + Dd 2cad = 3 1 20= 4
gaf = Da + Df 2caf = 3 + 9 2 0 = +6
cut-size = 16
gcb = Dc + Db 2ccb = 0 + 2 21 = 0
Pair with gcd = Dc + Dd 2ccd = 0 1 22 = 5
maximum gain gcf = Dc + Df 2ccf = 0 + 9 2 4 = +1
geb = De + Db 2ceb = +1 + 2 2 0 = +3
ged = De + Dd 2ced = +1 1 20= 0
gef = De + Df 2cef = +1 + 9 26= 2
3
a b f 1
b
4 1 2 4 1 2
3
2 2
2 c d c d
3 4 1 6 3 4
6 2
e f e a
cut-size = 16 cut-size = 16 6 = 10
cut-size = 10 cut-size = 10 ( 3) = 13
cd =D c+D d 2ccd = 0 + 1 22 = 3
f b = 0
c D b= 4
4
1 1 D e= 7 D d = +1
2 3
2
d c ={e}
6 3 ={b}
4
2
e a Update the D-values of unlocked nodes