Well-Separated Pair Decomposition
Seminar on Geometric Approximation Algorithms, Spring 2012Eyal Altshuler
Topics To Be Covered
Motivation WSPD – Basic Definitions WSPD – The Construction Algorithm Applications of WSPD
Approximating the diameter Closest pair Spanners Approximated minimum spanning tree
Motivation Given a set P of points in , We want to
represent the distances between them efficiently
Suggestions: ▪ explicitly listing the distances
▪ listing arrays of coordinates
We will see a more compact representation
Motivation Suppose that all we care about are approximate
distances
Want to capture that: s and q are close together as far as p is concerned s and q have the “same distance” from p
A “spoiler” for today’s data structure: () We will see how to build it
p
q
s
WSPD – Basic Definitions
[ All works in , we will concentrate on ]
Let P be a set of n points in
WSPD – Basic Definitions
Denote by
The set of all (unordered) pairs of points formed by two sets of points – A and B
Informally we will refer to as the pair of the sets A and B
WSPD – Basic Definitions
For a point set P, a pair decomposition of P is a set of pairs –
such that:▪ for every i▪ = for every i▪ =
WSPD – Basic Definitions
The pair Q and R is (-separated if
where
WSPD – Basic Definitionsmax (𝑑𝑖𝑎𝑚 (𝑄 ) , 𝑑𝑖𝑎𝑚 (𝑅 ) )≤𝜀∗𝒅 (𝑄 ,𝑅 )
Q
R
WSPD – Basic Definitions
For a point set P, a well-separated pair decomposition (WSPD) of P with parameter ( is a pair decomposition of P with a set of pairs-
such that, for any i, the sets and are ( separated
Example
a b
c
d e
f
Building a WSPD
How to represent a WSPD efficiently? Construct a Tree T having the points
of P as leaves.
Every Pair {} will be just a pair of nodes (, such that
denotes the points of P stored in the sub-tree of v
Reminder - Quadtrees
a b
c
d e
f
Reminder - Quadtrees
a
b c
d f e
a b
c
d e
f
Reminder - Quadtrees
Denote by the cell that contains the points that are in the subtree of v
Working with compressed quadtrees – time construction
Building a WSPD
Build T as a compressed quadtree
a
b c
d f e
Building a WSPD
Find the pairs of vertices that define a WSPD
a
b c
d f e
Notes
The quadtree decomposes the points such that the diameter of a point set stored in a node drops quickly as we go down the tree
A given tree can be used to represent many possible WSPDs. We are looking for the WSPD that is “minimal”
Notes Suppose we find, for a given , the pairs of
nodes that represent -separated point sets
This is the WSPD compact representation we want to achieve
It will be convenient, for each point set in a pair, to choose an arbitrary representative. Calculating distances between pairs will be done using these representatives
The Construction Algorithm Given – A set of n points P in
First, compute the quadtree T of P
Next, be greedy – by calling
algWSPD(root,root)
Some More Definitions
- the “diameter” of the cell associated with
for a leaf, otherwise
Examples
a
b c
d f
e
a b
c
d e
f
v
u
g g
?
Examples
a
b c
d f
e
a b
c
d e
f
v
u
g g
? 0
Examples
a
b c
d f
e
a b
c
d e
f
v
u
g g
𝒅 (𝑢 ,𝑣 )?
algWSPD(u,v) If and then
return // Don’t pair a leaf with itself
If then Exchange and
If then return
// - the children of return
Analysis
Computing the com-pressed quadtree T of P can be done in time (see previous lecture)
We will prove that constructing an -WSPD takes time
running time
Analysis
Lemma 1: Let be a cell of a grid G of with cell
diameter . For , the number of cells in G at distance at most from is
Proof:
x yy
y
y
Analysis
Lemma 2 (validity): algWSPD terminates and computes a
valid pair decomposition
Proof: Termination – always stops if both and
are leaves Every pair of points is covered – by
induction Every pair is valid -
Analysis
Lemma 3: (-WSPD) For the WSPD generated by algWSPD,
we have that for any pair in the WSPD,
and , for any ,
Analysis
Proof:𝑃𝑢𝑃𝑣
𝑑𝑖𝑎𝑚 (𝑃𝑢)≤△ (𝑢)𝑑𝑖𝑎𝑚 (𝑃𝑣 )≤△ (𝑣 )
,
Analysis
We got that the algorithm always return a valid -WSPD.
Note that the running time of the algorithm is clearly linear in its output size.
So, what is the output size?
Analysis
For a pair computed by algWSPD, we have that-
where denotes that parent of in T
Analysis
[
Proof: Trivial that-
Let us show that
Analysis
[
Consider the set of recursive calls𝑎𝑙𝑔𝑊𝑆𝑃𝐷 (𝑢𝑜 ,𝑢0)
𝑎𝑙𝑔𝑊𝑆𝑃𝐷 (𝑢1 ,𝑣1)
𝑎𝑙𝑔𝑊𝑆𝑃𝐷 (𝑢𝑠=𝑢 ,𝑣 𝑠=𝑣)
Analysis
[
Assume
𝑎𝑙𝑔𝑊𝑆𝑃𝐷 (𝑢𝑜 ,𝑢0)
𝑎𝑙𝑔𝑊𝑆𝑃𝐷 (𝑢1 ,𝑣1)
𝑎𝑙𝑔𝑊𝑆𝑃𝐷 (𝑢𝑠=𝑢 ,𝑣 𝑠=𝑣)
Analysis
[ Assume
Clearly,
△ (𝑢) △𝑝 (𝑣)
Analysis
[ Similarly consider the index t where-
Clearly,
△ (𝑣𝑡 −1)△𝑝 (𝑢)
Analysis
Lemma: (WSPD’s size)The number of pairs in the computed WSPD is
Corollary: For , one can construct an -WSPD of size , and the construction time is
Analysis
Proof: Suppose in the output Suppose was called by
“charge” for that Show that can’t be charged too
much
Analysis
If:
Then: △ (𝑢) △ (𝑝 (𝑢))
△ (𝑣 ′ )
Analysis
In addition-
Because the pair is not in the output
Denote-
Analysis
Suppose the three possibilities Each one can happen at most times
(show on board)
There are n possible s, thus the total number of charges is
△ (𝑢) △ (𝑝 (𝑢))△ (𝑣 ′ )
Applications
remember from algWSPD For an -WSPD , it holds, for any pair ,
that:
Will be very important in the application side
Applications – Approximating The Diameter Given a set P of n points in , find a
pair such that , where is the diameter of P
Approximation vs. time, space
Applications – Approximating The Diameter
Applications – Approximating The Diameter The affect of choosing the correct
epsilon Compute a -WSPD W of P
From the result-
Return the representatives of that have maximal distance between them
Applications – Approximating The Diameter
𝑃𝑢
𝑃𝑣
q
s
𝑑(𝑢 ,𝑣 )
Applications – Approximating The Diameter Consider the pair realizing the
diameter of P Let be the pair that contain the
points 𝑃𝑢
𝑃𝑣
q
s
𝑑(𝑢 ,𝑣 )
Applications – Closest Pair Let P be a set of points in . We would
like to compute the closest pair. (first lecture)
Let be an -WSPD.
Let us look at closest points p and q in P, and consider the pair that separates them
Applications – Closest Pair𝑃𝑢
𝑃𝑣p
s q
‖𝑝−𝑠‖≤𝑑𝑖𝑎𝑚 (𝑃𝑢)≤ 𝜀∗𝑑 (𝑢 ,𝑣 )≤ 𝜀‖𝑝−𝑞‖<‖𝑝−𝑞‖Contradiction for
Applications – Closest Pair Thus, The pair of the closest points
will contain the as singletons
Compute a 2-WSPD ( ) Scan all the pairs of W, and take the
minimum distance between pairs that connects singletons
=
Applications - spanners
Describe distances between n points by using a sparse graph
Useful if it has edges
Implicit representation of all the (approximated) distances
Applications - spanners
The model -
Graph distance - for every
Applications - spanners
A t-spanner of a set of points is a weighted graph
For any we have-
t is called the stretch of q and s in G
The stretch of G is the maximal stretch between two points
Applications - spanners
Theorem: Given a set P of n points in and a
parameter , we can construct a -spanner of P
Num of edges - ) time
Applications - spanners
Let C be an arbitrary constant Denote
Compute a -WSPD For every pair , add an edge
between and with weight
Correctness: by induction
Applications - spanners
𝑑
𝑃𝑢𝑃𝑣
𝑥𝑦
𝑟𝑒𝑝𝑢𝑟𝑒𝑝𝑣
Applications- Approximated Minimum Spanning Tree Given a point set P of n points,
compute a spanning tree T of weight-
Where M is a minimum spanning tree
, compared to deterministic
Applications- Approximated Minimum Spanning Tree Compute a -spanner G of P
Compute a MST(G), and return it
Intuitively – use spanner as sparse graph, it will be approximated enough for a minimum spanning tree
Applications- Approximated Minimum Spanning Tree Computation time –
Required approximation- - shortest path in G By spanners - ) Find a spanning sub-graph of
of weight