Skip to main content
. Author manuscript; available in PMC: 2017 Oct 26.
Published in final edited form as: Proc IEEE Int Conf Clust Comput. 2017 Sep 26;2017:25–35. doi: 10.1109/CLUSTER.2017.28

Algorithm 2.

Reuse-Tree Merging Algorithm (RTMA)

1: Input: stages; maxBSize; ▹maxBSize refers to maxBucketSize
2: Output: bucketList;
3: bucketList ← ∅;
4: rTree G ← ENERATEREUSETREE(stages)
5: while rTree.height > 2 do
6:  leafsPList ← GENERATELEAFSPARENTLIST(rTree)
7:  newBuckets ← PRUNELEAFLEVEL(rTree, leafsPList, maxBSize)
8:  bucketList ← bucketList ∪ newBuckets
9:  MOVEREUSETREEUP(reuseTree, leafsPList)
10: while rTree.root.children ≠ ∅ do
11:  bucket ← ∅
12: while rTree.root.children ≠ ∅ and bucket.size ≤ maxBSize do
13:   newBucket ← removeFirstChildren(rTreeRoot);
14:  bucketList ← bucketList ∪ bucket
15: return bucketList