Input: CC(Si, Sj): Matrix of communication cost between sites CR: Clustering Range NS: Number of sites in the distributed database system network Output: CSM: Clusters Set Matrix Step 1: Set 1 to i Step 2: Do steps (3 - 12) until i > NS Step 3: Set 1 to j Set 0 to k Set 0 to Sum Set 0 to Average Set 0 to clusters matrix CM Step 4: Do steps (5 - 10) until j > NS Step 5: If i ¹ j AND CC(Si, Sj) <= CR, go to step (6) Else, go to step (7) Step 6: Set 1 to the CM(Si, Sj) and CM(Sj, Si) in the clusters matrix Add CC(Si, Sj) to sum Add 1 to k Go to step 8 Step 7: Set 0 to the CM(Si, Sj) and CM(Sj, Si) in the clusters matrix Step 8: End IF Step 9: Add 1 to j Step 10: Loop Step 11: Average = Sum/k Average(i) = Average Add 1 to i Step 12: Loop Step 13: Set 1 to m Step 14: Do steps (15 - 36) until m > NS Step 15: Set 1 to q Set 0 to Minaverage Set 0 to Minrow Step 16: Do steps (17 - 20) until q > NS or Minaverage > 0 Step 17: If Average(q) > 0 Then Minaverage = Average(q) Else Go to Step 18 Step 18: End If Step 19: Add 1 to q Step 20: Loop Step 21: If Minaverage = 0 Then Set site number to a new cluster Else Go to Step 22 Step 22: End If Step 23: Set 1 to p Step 24: Do steps (25 - 28) until p > NS Step 25: If Average(p) > 0 AND Average(p) < Minaverage Then Minaverage = Average(p) Minrow = p Step 26: End IF Step 27: Add 1 to p Step 28: Loop Step 29: Set 1 to a Step 30: Do steps (31 - 34) until a > NS Step 31: If CM(Sminrow, Sa) = 1 Then Set 1 to CSM(Sminrow, Sa) CM(Sminrow, Sa) = 0 Step 32: End IF Step 33: Add 1 to a Step 34: Loop Step 35: Add 1 to m Step 36: Loop Step 37: Stop |