Parallel Algorithms for the Convex Hull Problem

John Daigle

Georgia State University

Overview

Introduction to the Problem


Using the Bridging Model

[any material that should appear in print but not on the slide]

Definitions

Convex
A subset Q of the plane is convex if and only if:
&forall p, q &isin Q, line seqment pq is completely contained in Q

Convex Hull
The smallest convex set containing Q, denoted as CH(Q)

Sequential Algorithm

The Divide and Conquer Approach


Given a set of points in d dimensional Euclidian Space Ed

Algorithm CH
Input: A set S{a1,..., an}, where ai&isin Ed and xi(ai) < xj(aj)for i, j = 1,..., n.
Output: The Convex Hull CH(S)of S
  1. Subdivide S into S1 = {a1,..., a&lfloor½n&rfloor} and S2 = {a&lfloor½n&rfloor+1,..., an}
  2. Apply recursively CH to S1 and S2 to obtain CH(S1) and CH(S2)
  3. Apply a merge algorithm to CH(S1) and CH(S2) to obtain CH(S) and halt.

Sequential Algorithm

The Divide and Conquer Approach

Analysis

The PRAM algorithm

PRAM CH(n, Q, CH(Q))
  1. Sort the points of Q by their xcoordinates
  2. Partition Q into n½ subsets Q1,Q2, ... Qn½
  3. FOR i = 1 to n½ do in parallel

  4. IF points in Qi &le 3 THEN CH(Qi)=Qi
    ELSE PRAM CH(n½,Qi,CH(Qi))
  5. CH(Q) &larr Q1 &cup Q2, Q3, &cup ... &cup Qn½

The PRAM algorithm

The PRAM algorithm is initially quite simple. The points are sorted in increasing order by x coordinate. Then, the Set is partitioned into n½ subsets, Q1,Q2, Q3, ... Qn½, such that for all qi &isin Qi, &forall qj&isin Qj, the x coordinate of qi < x of qj.

The PRAM algorithm

Step 3 is the recursive step that finds the hull, when |Qi| &le 3, this group is returned as the convex hull of Qi, that is, in a group of 3 or fewer points, all of the points are in the hull.

Merging a Set of Disjoint Polygons

The Convex Hull consists of two parts:

Identifying the Upper Hull

Identifying the Upper Hull

Identifying a Tangent

A tangent between two polygon a and b is a line which runs through a single point k of a and a single point m of b without passing through either a or b.

To compute a tangent between CH(Qi) and CH(Qj), we select a point in the middle of the sequence from u to v of both Qi and Qj (the midpoint of the upper hull of each polygon). For Qi call this s, and w for Qj

  1. Either (s,w) is the upper common tangent of CH(Qi) and CH(Qj), in which case we are done.
  2. Or we can eliminate one half of the remaining corners of CH(Qi) and CH(Qj) as candidates for k, m

Identifying a Tangent

Simple cases of tangents and rules for elimination.

Analysis of the PRAM algorithm

Analysis of the PRAM algorithm

The Bridging Model

The Bridging Model

BSP supersteps

BSP Terms

A BSP Communication is described by

O(T1 + (L + gh)TC)

A BSP algorithm for Convex Hull

Assuming n>h
  1. Sort the input points.
  2. Divide the input into O(n¼) groups of size O(n¾ each, and recursively find the upper hull of each set.
  3. Find the common upper tangents by simulating a PRAM method (similar to what we have done)
  4. Calculate the upper tangents as we have seen
  5. Perform a parallel prefix computation to compress the points on the upper hull.

Analysis of the BSP algorithm

  1. Sorting: O(loghn) communication rounds, combined running time of O((nlogn)/p + (L + gh) loghn)
  2. The recursive step: T(n¾)
  3. Simulating PRAM tangent finding O(loghn)
  4. Tangent finding remains constant
  5. Parallel prefix finding is still log time:O(logdk+&lceilm/h&rceil) (where d = 2&lceilh/m&rceil and the input is a k×m array.
  6. Total time is T(n) = T(n¾) + O(loghn)