Chan’s algorithm CS504 Presentation
Graham’s Scan : 𝑂(𝑛 log 𝑛 ) Jarvis’s March : 𝑂(𝑛ℎ) Planar Convex Hull Graham’s Scan : 𝑂(𝑛 log 𝑛 ) Jarvis’s March : 𝑂(𝑛ℎ) Is there any 𝑂(𝑛 log ℎ ) algorithm? CS504 Presentation
3 stages of Chan’s algorithm combining Graham’s scan and Jarvis’s March together 𝑂 𝑛 log ℎ 3 stages of Chan’s algorithm divide vertices into partitions apply Graham’s scan on each partition apply Jarvis’s March on the small convex hull (repeat 1~3 until we find the hull) CS504 Presentation
Consider arbitrary value 𝑚<𝑛, the size of partition Chan’s Algorithm Stage1 : Partition Consider arbitrary value 𝑚<𝑛, the size of partition how to decide 𝑚 will be treated later Partition the points into groups, each of size 𝑚 𝑟= 𝑛 𝑚 is the number of groups CS504 Presentation
Chan’s Algorithm Stage 1 n = 32 Set m = 8 CS504 Presentation
Chan’s Algorithm Stage 1 n = 32 Set m = 8 r = 4 CS504 Presentation
Compute convex hull of each partition using Graham’s scan Chan’s Algorithm Stage2 : Graham’s Scan Compute convex hull of each partition using Graham’s scan Total 𝑂(𝑛 log 𝑚 ) time CS504 Presentation
Chan’s Algorithm Stage 2 (After Stage 1) m = 8 r = 4 CS504 Presentation
Chan’s Algorithm Stage 2 Using Graham’s Scan O 𝑚 log 𝑚 for each group -> total 𝑂(𝑚𝑟 log 𝑚 ) = 𝑂(𝑛 log 𝑚 ) CS504 Presentation
How to merge these r hulls into a single hull? Chan’s Algorithm Stage3 : Jarvis’s March How to merge these r hulls into a single hull? IDEA : treat each hull as a “fat point” and run Jarvis’s March! # of iteration is at most m to guarantee the time complexity O(nlogh) CS504 Presentation
Chan’s Algorithm (-inf,0) -> lowest pt (−∞,0) lowest pt CS504 Presentation
Find the point that maximize the angle in each hull Chan’s Algorithm Find the point that maximize the angle in each hull (−∞,0) 1 lowest pt CS504 Presentation
Find the point that maximize the angle in each hull Chan’s Algorithm Find the point that maximize the angle in each hull (−∞,0) 2 1 lowest pt CS504 Presentation
Find the point that maximize the angle in each hull Chan’s Algorithm Find the point that maximize the angle in each hull 3 (−∞,0) 2 1 lowest pt CS504 Presentation
Chan’s Algorithm If 𝑚<ℎ, then the algorithm will fail! CS504 Presentation
FAIL EXAMPLE – too small value m Chan’s Algorithm FAIL EXAMPLE – too small value m m = 4 (−∞,0) 4 iteration CS504 Presentation
Chan’s Algorithm In 4(a), how to find such points? CS504 Presentation
Find the point that maximize the angle in each hull Chan’s Algorithm Find the point that maximize the angle in each hull (−∞,0) 1 lowest pt CS504 Presentation
Find the point that maximize the angle in a hull Chan’s Algorithm Find the point that maximize the angle in a hull (−∞,0) CS504 Presentation
Finding tangent between a point and a convex 𝑚-gon Chan’s Algorithm Finding tangent between a point and a convex 𝑚-gon 5 1 𝑂 log 𝑚 process 4 3 2 CS504 Presentation
Chan’s Algorithm → 𝑂( log 𝑚 ) CS504 Presentation
Chan’s Algorithm Analysis Suppose God told you some good value for 𝑚 ℎ≤𝑚≤ ℎ 2 𝑂 𝑛 log 𝑚 for stage1~2 At most h steps in Jarvis’s March 𝑂( log 𝑚 ) time to compute each tangent 𝑟 tangent for each iteration total 𝑂 ℎ𝑟 log 𝑚 =𝑂(ℎ 𝑛 𝑚 log 𝑚 ) time 𝑂 𝑛+ℎ 𝑛 𝑚 log 𝑚 =𝑂 𝑛 log 𝑚 =𝑂(𝑛 log ℎ ) as desired. 𝑚≤ ℎ 2 CS504 Presentation
The only question remaining is… Chan’s Algorithm The only question remaining is… how do we know what value to give to 𝑚? CS504 Presentation
Then we eventually get 𝑚 to be in [ℎ, ℎ 2 ] ! Chan’s Algorithm Answer : square search Try this way - 𝑚=2, 4, 8, …, 2 2 𝑡 , … Then we eventually get 𝑚 to be in [ℎ, ℎ 2 ] ! CS504 Presentation
The algorithm stops as soon as 2 2 𝑡 ≥ℎ Chan’s Algorithm The algorithm stops as soon as 2 2 𝑡 ≥ℎ 𝑡= lg lg ℎ Total time complexity 𝑡=1 lg lg ℎ 𝑛 log 2 2 𝑡 = 𝑡=1 lg lg ℎ 𝑛 2 𝑡 ≤𝑛 2 1+ lg lg ℎ =2𝑛 2 lg lg ℎ =2𝑛 log ℎ =𝑂(𝑛 log ℎ ) CS504 Presentation