The BBS Algorithm The BBS Algorithm The BBS Algorithm Prof. Paolo Ciaccia Prof. Paolo Ciaccia http://www http:// www- -db.deis.unibo.it db.deis.unibo.it/ /courses courses/SI /SI- -LS/ LS/ 04.2_BBSAlgorithm.pdf 04.2_BBSAlgorithm.pdf Sistemi Informativi LS The BBS Algorithm � These slides provide a more informative description of the BBS (Branch and Bound Skyline) algorithm [PTF+03] for computing the Skyline of a relation, assuming that all attributes of interest need to be minimized � The basic objective of the algorithm is to avoid accessing index nodes that cannot contain any skyline object � To this end, index nodes are managed using a priority queue PQ, ordered by increasing values of MinDist � Since the “target point” is 0 = (0,..,0), this is to say that nodes are ordered using the distance from 0 of their lower-left corner � For computational economy, [PTF+03] evaluates distances using L1 (Manhattan distance) Sistemi Informativi LS 2 1
The BBS algorithm Input : index tree with root node RN Output : SL, the set of Skyline objects 1. Initialize PQ with [ptr(RN),Dom(R),0]; // starts from the root node 2. SL := ∅ ; // the Skyline is initially empty 3. while PQ ≠ ∅ : // until the queue is not empty… 4. [ptr(Elem), key(Elem), d MIN ( 0 ,Reg(Elem))] := DEQUEUE(PQ); 5. If no point in SL dominates Elem then: if Elem is an object o then: SL := SL ∪ {o} 6. 7. else: { Read(Elem); // …node Elem might contain Skyline points 8. if Elem is a leaf then: { for each point o in Elem: 9. if no point in SL dominates o then: 10. ENQUEUE(PQ,[ptr(o), key(o), L1( 0 ,key(o))]) } 11. else: { for each child node Nc of Elem: 12. if no point in SL dominates Nc then: 13. ENQUEUE(PQ,[ptr(Nc), key(Nc), d MIN ( 0 ,Reg(Nc))]) }}; 14. return SL; 15. end. Sistemi Informativi LS 3 BBS: An example (1/2) � distance: L1 d MIN Elem A 7 B 10 C 7 10 D 11 9 E 12 D E J 8 K F 8 N6 N4 G 9 7 I C H 12 6 I 15 A2 5 J 16 A N3 B 4 K 17 N1 H N1 5 N5 3 F G N2 7 2 N3 6 N2 1 N4 7 0 N5 7 N6 14 0 1 2 3 4 5 6 7 8 9 10 A1 Sistemi Informativi LS 4 2
BBS: An example (2/2) 10 9 D E J Action PQ 8 K N6 Read(RN) (N1,5) (N2,7) N4 7 Read(N1) (N3,6) (N4,7) (N2,7) C I 6 Read(N3) (A,7) (N4,7) (N2,7) (B,10) Return(A) (N4,7) (N2,7) (B,10) A2 5 A N3 B Read(N4) (C,7) (N2,7) (B,10) 4 Return(C) (N2,7) (B,10) N1 H N5 3 F Read(N2) (N5,7) (B,10) G 2 Read(N5) (F,8) (G,9) (B,10) N2 Return(F) (G,9) (B,10) 1 Return(G) (B,10) 0 0 1 2 3 4 5 6 7 8 9 10 A1 � The example clearly shows why an object currently undominated, such as B, needs to be inserted into the queue Sistemi Informativi LS 5 3
Recommend
More recommend