Distributed Database
Management Systems
Lecture 18
In the previous lecture
• Continue with VF
– Information Requirement
– Attribute affinities
Virtual University of Pakistan
2
In this Lecture
• Continue with VF
– Global Affinity Measure
– Bond Energy Algorithm
Virtual University of Pakistan
3
n
n
∑ ∑ aff(Ai, Aj) [aff(Ai, Aj1) + aff(Ai, Aj+1)
+ aff(A
) + aff(A
i1, A
i+1, Aj) ]
A
A
A j
A
AM =
i = 1 j = 1
1
2
3
4
A1
45
0
45
0
A2
0
80
5
75
A3
45
5
53
3
A4
0
75
3
78
Virtual University of Pakistan
4
The AA is symmetric so
A1
A2
A3
A4
A1
45
0
45
0
A2
0
80
5
75
A3
45
5
53
3
A4
0
75
3
78
Virtual University of Pakistan
5
Rather than taking..
n
n
∑ ∑ aff(Ai, Aj) [aff(Ai, Aj1) + aff(Ai, Aj+1)
+ aff(Ai1, Aj) + aff(Ai+1, Aj) ]
AM =
i = 1 j = 1
We take only..
n
n
n
∑ aff(A , A ) aff(A , A
∑ ∑
aff(Ai, Aj) aff(Ai, Aj1) +
AM =
i = 1
j = 1 i = 1
n
Let
bond(Ax, Ay) =
∑
i
j
aff(Az, Ax)aff(Az, Ay)
z = 1
n
∑
bond(Aj, Aj1) +bond(Aj, Aj+1)
AM =
j = 1
Virtual University of Pakistan
6
i
)
j+1
n
∑
AM =
j = 1
bond(Aj, Aj1) +bond(Aj, Aj+1)
J=1
45
0
45
0
0
80
5
75
45
5
53
3
0
75
3
78
Virtual University of Pakistan
7
n
∑
AM =
j = 1
bond(Aj, Aj1) +bond(Aj, Aj+1)
J=2
45
0
45
0
0
80
5
75
45
5
53
3
0
75
3
78
Virtual University of Pakistan
8
n
∑
AM =
j = 1
bond(Aj, Aj1) +bond(Aj, Aj+1)
J=4
45
0
45
0
0
80
5
75
45
5
53
3
0
75
3
78
Virtual University of Pakistan
9
Approach for VF
• Find the combination that has the
maximum Affinity Measure
• It will represent best grouping among
attributes
Virtual University of Pakistan
10
• We can find all possible AMs or
• We can use the BEA (Bond
Energy Algorithm)
Virtual University of Pakistan
11
Bond Energy Algorithm
A1, A2, …, Ai-1, Ai, Aj, Aj+1, ……, An
AM1
AM2
AM3
AMold = AM1 + AM2+ AM3
AM2 involves Bond(Ai, Aj) twice
Virtual University of Pakistan
12
BEA
A1, A2, …, Ai-1, Ai, Ak, Aj, Aj+1, ……, An
AM1
AM2
AM3
AMnew = AM1 + AM2+ AM3
AM2 involves Bond(Ai, Ak) and
Bond(Ak, Aj) twice
Virtual University of Pakistan
13
BEA Contribution
cont(Ai, Ak, Aj) is the contribution in AM
when placing Ak between Ai and Aj
Cont(Ai, Ak, Aj) =
AMnew- AMold
= 2Bond(Ai,Ak) + 2Bond(Aj, Ak) –
2Bond(Ai, Aj)
Virtual University of Pakistan
14
Steps in BEA
Virtual University of Pakistan
15
• Input: The AA matrix
• Output: The clustered affinity matrix CA which is
a permutation of AA
• Initialization: Place and fix one of the columns of
AA in CA.
• Iteration: Place the remaining n-i columns in the
remaining i+1 positions in the CA matrix. For
each column, choose the placement that makes
the most contribution to the global affinity
measure.
• Row order: Order the rows according to the
column ordering.
Virtual University of Pakistan
16
Bond Energy Algorithm
Virtual University of Pakistan
17
•
•
•
Input AA
Output CA
Begin
CA (•, 1) ← AA (•, 1)
CA (•, 2) ← AA (•, 2)
Index ← 3
Virtual University of Pakistan
18
While index ≤ n do
Begin
For I from 1 to index –1 by 1 do
calculate cont(Ai-1, Aindex, Ai) end-for
Calculate cont(Aindex-1, Aindex, Aindex+1)
Loc ← placement given by maximum cont value
For j from index to loc by –1 do
CA (•, j) ← AA (•, j-1)
end-for
CA (•, loc) ← AA (•, index)
Index ← index + 1
End-while
Order the rows according to relative order of columns
End {BEA}
Virtual University of Pakistan
19
Thanks
Virtual University of Pakistan
20