In computational geometry, a well-separated pair decomposition (WSPD) of a set of points
S\subsetRd
(Ai,Bi)
p,q\inS
The graph induced by a well-separated pair decomposition can serve as a k-spanner of the complete Euclidean graph, and is useful in approximating solutions to several problems pertaining to this.[1]
Let
A,B
Rd
R(X)
X
s>0
We consider
A
B
R(A)
R(B)
\rho
s\rho
We consider a sequence of well-separated pairs of subsets of
S
(A1,B1),(A2,B2),\ldots,(Am,Bm)
S
p,q\inS
i
1\leqi\leqm
p\inAi
q\inBi
q\inAi
p\inBi
By way of constructing a fair split tree, it is possible to construct a WSPD of size
O(sdn)
O(nlgn)
The general principle of the split tree of a point set is that each node of the tree represents a set of points and that the bounding box of is split along its longest side in two equal parts which form the two children of and their point set. It is done recursively until there is only one point in the set.
Let denote the size of the longest interval of the bounding hyperrectangle of point set and let denote the size of the i-th dimension of the bounding hyperrectangle of point set . We give pseudocode for the Split tree computation below.
Let be the node for if // is a hyperrectangle which each side has a length of zero. Store in the only point in S. else Compute Let the i-th dimension be the one where Split along the i-th dimension in two same-size hyperrectangles and take the points contained in these hyperrectangles to form the two sets and . Store and as, respectively, the left and right children of . return
This algorithm runs in
O(n2)
We give a more efficient algorithm that runs in
O(nlgn)
O(n)
Let be the i-th coordinate of the j-th point in such that is sorted according to the i-th coordinate and be the point. Also, let be the hyperplane that splits the longest side of in two. Here is the algorithm in pseudo-code:
if // is a hyperrectangle which each side has a length of zero. Store in the only point in . else repeat Compute Let the i-th dimension be the one where while and Let and be respectively, the left and right children of . if else if until
To be able to maintain the sorted lists for each node, linked lists are used. Cross-pointers are kept for each list to the others to be able to retrieve a point in constant time. In the algorithm above, in each iteration of the loop, a call to the recursion is done. In reality, to be able to reconstruct the list without the overhead of resorting the points, it is necessary to rebuild the sorted lists once all points have been assigned to their nodes. To do the rebuilding, walk along each list for each dimension, add each point to the corresponding list of its nodes, and add cross-pointers in the original list to be able to add the cross-pointers for the new lists. Finally, call the recursion on each node and his set.
The WSPD can be extracted from such a split tree by calling the recursive function on the children of every node in the split tree. Let / denote the children of the node . We give pseudocode for the function below.
FindWSPD(T, s) for each node u that is not a leaf in the split tree T do FindPairs(ul, ur)
We give pseudocode for the function below.
FindPairs(v, w) if and are well-separated with respect to report else if Recursively call and else Recursively call and
Combining the -well-separated pairs from all the calls of gives the WSPD for separation .
It is clear that the pairs returned by the algorithm are well-separated because of the return condition of the function .
Now, we have to prove that for any distinct points
p
q
S
\{A,B\}
p\inA
q\inB
p\inB
q\inA
Let
u
p
q
v
w
u
p
v
q
w
p
A
q
B
Because
u
p
q
p
q
u
p
q
\{A,B\}
p
q
Each time the recursion tree split in two, there is one more pair added to the decomposition. So, the algorithm run-time is in the number of pairs in the final decomposition.
Callahan and Kosaraju proved that this algorithm finds a Well-separated pair decomposition (WSPD) of size
O(sdn)
Lemma 1: Let
\{A,B\}
s
p,p'\inA
q\inB
|pp'|\leq(2/s)|pq|
Proof: Because
p
p'
|pp'|\leq2\rho
\rho
A
B
p
q
|pq|\geqs\rho
\begin{align} &
|pp'| | |
2 |
\leq\rho\leq
|pq| | |
s |
\\ \Leftrightarrow&\\ &
|pp'| | |
2 |
\leq
|pq| | |
s |
\\ \Leftrightarrow&\\ &|pp'|\leq
2 | |
s |
|pq|\\ \end{align}
Lemma 2: Let
\{A,B\}
s
p,p'\inA
q,q'\inB
|p'q'|\leq(1+4/s)|pq|
Proof: By the triangle inequality, we have:
|p'q'|\leq|p'p|+|pq|+|qq'|
From Lemma 1, we obtain:
\begin{align} |p'q'|&\leq(2/s)|pq|+|pq|+(2/s)|pq|\\ &=(1+4/s)|pq| \end{align}
The well-separated pair decomposition has application in solving a number of problems. WSPD can be used to:
O(nlgn)
O(nlgn+k)
O(nlgn)
O(nlgn)
(1-\epsilon)
O(nlgn)
O(nlgn)
(1+\epsilon)
O(nlgn+(\epsilon-2lg2
1 | |
\epsilon |
)n)