70 likes | 305 Views
p 4. p 1. p 6. p 2. p 7. p 8. p 3. p 5. Plane Sweep Algorithm for Closest Pair Problem. A = p 4 B = p 5 CP = E[ p 7 , p 2 , p 3 , p 6 , p 1 , p 8 ] S[p 4 , p 5 ] d min = d 45. E=Event Queue S=Status Queue A,B = Current closest pair CP = Current point
E N D
p4 p1 p6 p2 p7 p8 p3 p5 Plane Sweep Algorithm for Closest Pair Problem A = p4 B = p5 CP = E[ p7 , p2 , p3 , p6 , p1 , p8 ] S[p4 , p5 ] dmin = d45 E=Event Queue S=Status Queue A,B = Current closest pair CP = Current point dmin = Current minimum distance (distance between point A and B) dij = distance between pi and pj
p4 p1 p6 p2 p7 p8 p3 p5 Previous A = p4 B = p5 CP = E[ p7 , p2 , p3 , p6 , p1 , p8 ] S[ p4 , p5 ] dmin = d45 d45 New A = p4 B = p5 CP = p7 E[ p7 , p2 , p3 , p6 , p1 , p8 ] S[ p4 , p5 , p7 ] dmin <= min (dmin , d57 ) = d45
p4 p1 p6 p2 p7 p8 p3 p5 Previous A = p4 B = p5 CP = p7 E[ p2 , p3 , p6 , p1 , p8 ] S[ p5 , p7 ] dmin = d45 d45 New A = p2 B = p7 CP = p2 E[ p2 , p3 , p6 , p1 , p8 ] S[ p5 , p7 , p2 ] dmin <= min (dmin , d25 , d27 ) = d27
p4 p1 p6 p2 p7 p8 p3 p5 Previous A = p2 B = p7 CP = p2 E[ p3 , p6 , p1 , p8 ] S[ p5 , p7 , p2 ] dmin = d27 d27 New A = p2 B = p7 CP = p3 E[ p3 , p6 , p1 , p8 ] S[ p5 , p7 , p2 , p3 ] dmin <= d27
p4 p1 p6 p2 p7 p8 p3 p5 Previous A = p2 B = p7 CP = p3 E[ p6 , p1 , p8 ] S[p3 ] dmin <= d27 New A = p3 B = p6 CP = p6 E[ p6 , p1 , p8 ] S[ p3 , p6 ] dmin <= min (dmin , d36 ) = d36 d27
p4 p1 p6 p2 p7 p8 p3 p5 Previous A = p3 B = p6 CP = p6 E[ p1 , p8 ] S[p3 , p6 ] dmin <= d36 New A = p3 B = p6 CP = p1 E[ p1 , p8 ] S[ p3 , p6 , p1 ] dmin <= d36 d36
p4 p1 p6 p2 p7 p8 p3 p5 Previous A = p3 B = p6 CP = p1 E[ p8 ] S[ p1 ] dmin <= d36 New A = p3 B = p6 CP = p8 E[ p8 ] S[ p1 , p8 ] dmin <= d36 d36 Event Queue Is Empty, therefore STOP