Docsity

Kinetic Data Structures: Advanced Algorithms and Continuous Updates - Prof. Jeff G. Ericks, Study notes of Algorithms and Programming

Toggle sidebar
bg1
CS 573: Topics in Algorithms: Advanced Data Structures Spring 2006
Lecture 11 — February 21 and 23
Lecturer: Jeff Erickson Scribe: Tracy Grauman
Up until now, we have been talking about maintaining data structures which could handle
such familiar requests as asking it a query or requesting that it change its structure in some
discrete way. Now we are going to change our focus to look at kinetic data structures, which
change continuously. Basch*, Guibas, and Hershberger [1],[4] were the first ones to nail down
the general rules for kinetic data structures in that paper.
11.1 Kinetic Data Structures - General Rules
•Values/weights/coordinates are continuous functions of time.
We need to be careful with our usage of the word “time” in this context. “Time”
doesn’t refer to computational cost (ie: counting CPU operations), but rather denotes
a more environmental sense of the word, as marked by a clock on the wall.
•Maintain the data structure that would be built at any given instant.
As an example, a kinetic data structure should be able to return to you if a node v
exists now. Or if it exists now. How about right now?
•The data structure changes discretely.
We want to imagine our data structure as a function of time, not that there’s just some
Genie popping in and rewriting data at will. That is, for the duration of some interval,
our data structure remains fixed. Then, at some discrete moment, the structure changes
as the result of some functions stored at its nodes.
•Maintain a proof of correctness for the data structure. When a certificate
fails, update the data structure and its proofs.
Updates to correct failed certificates are assumed to take no wall-clock time, though
it obviously must use some cpu cycles. Essentially, one would have to ensure that
updates are resolved more quickly than the time it takes for the next query to reach
the expired parts of the structure.
Evaluation Criteria for Kinetic Data Structures
1. Responsive: When a certificate expires, we can update the data structure quickly (in
O(log n) time)
2. Local: No object participates in many certificates, resulting in fast motion changes.
3. Compact: The number of certificates is small compared to a static data structure.
4. Efficient: # of events in data structure in the worst case
# of necessary changes to keep maintained in worst case (a particularly fuzzy area)
11-1
pf3
pf4
pf5
pf8

Partial preview of the text

Download Kinetic Data Structures: Advanced Algorithms and Continuous Updates - Prof. Jeff G. Ericks and more Study notes Algorithms and Programming in PDF only on Docsity!

CS 573: Topics in Algorithms: Advanced Data Structures Spring 2006

Lecture 11 — February 21 and 23

Lecturer: Jeff Erickson Scribe: Tracy Grauman

Up until now, we have been talking about maintaining data structures which could handle such familiar requests as asking it a query or requesting that it change its structure in some discrete way. Now we are going to change our focus to look at kinetic data structures, which change continuously. Basch*, Guibas, and Hershberger [1],[4] were the first ones to nail down the general rules for kinetic data structures in that paper.

11.1 Kinetic Data Structures - General Rules

  • Values/weights/coordinates are continuous functions of time. We need to be careful with our usage of the word “time” in this context. “Time” doesn’t refer to computational cost (ie: counting CPU operations), but rather denotes a more environmental sense of the word, as marked by a clock on the wall.
  • Maintain the data structure that would be built at any given instant. As an example, a kinetic data structure should be able to return to you if a node v exists now. Or if it exists now. How about right now?
  • The data structure changes discretely. We want to imagine our data structure as a function of time, not that there’s just some Genie popping in and rewriting data at will. That is, for the duration of some interval, our data structure remains fixed. Then, at some discrete moment, the structure changes as the result of some functions stored at its nodes.
  • Maintain a proof of correctness for the data structure. When a certificate fails, update the data structure and its proofs. Updates to correct failed certificates are assumed to take no wall-clock time, though it obviously must use some cpu cycles. Essentially, one would have to ensure that updates are resolved more quickly than the time it takes for the next query to reach the expired parts of the structure.

Evaluation Criteria for Kinetic Data Structures

  1. Responsive: When a certificate expires, we can update the data structure quickly (in O(log n) time)
  2. Local: No object participates in many certificates, resulting in fast motion changes.
  3. Compact: The number of certificates is small compared to a static data structure.
  4. Efficient: (^) # of necessary changes to keep maintained in worst case# of events in data structure in the worst case (a particularly fuzzy area)

11.2 A Kinetic Dictionary

Consider supporting two queries to a kinetic dictionary,

Find(t, x): Asks “Is there a node whose value at time t is equal to x?”

Update(t, v, y): Change function at node v to y : R → R, where the value of the function of node v at time t, xv(t) = y(t).

We want to store our binary search tree, where the keys are functions. At any instant, the tree should be in sorted order. That is, for an adjacent pair (xi, xi+1), xi < xi+1. We want to compute the first moment, t, when this inequality doesn’t hold. Thus, maintain in a priority queue the result of the following function:

t(xi, xi+1) = min{t|xi(t) ≥ xi+1(t)}

(Note: Strictly speaking, we should use “infimum” instead of “minimum.”)

When this happens, surgery is needed on our binary tree, resolved by reassigning parent- child pointers. We must make one of two assumptions: either that at most one event happens at any instant or that we have a mechanism for ordering concurrent events.

Event: //(xi, xi+1) expired swap xi and xi+1 in binary search tree insert xi+1, xi) with new certificate update certificates for (xi+1, x + i) and (xi+1, xi+2) As mentioned, the evaluation of efficiency can be a fuzzy area, and here we have one example of this. In one way, our algorithm is very efficient, as it only does necessary updates. On the other hand, if we never ask the structure any queries, then we never really need to keep the structure up-to-date, making any updates arguably “inefficient.”

11.3 Kinetically Maintaining the Largest Element

11.3.1 Two Not-So-Great Ideas

Maintain Entire Sorted Order

We could maintain the entire sorted order of all our elements. Clearly, though, this is simply not efficient, as the maximum number of changes is O(

(n 2

Keep Track of the Upper Hull

Assuming we know all of our functions in advance, we could plot them on a graph and look at the upper hull of the graph. However, if one of the functions should change its trajectory, we may have to recalculate the upper hull, a costly operation.

Figure 11.2. A kinetic heap and its comparisons

Proving the Efficiency of Kinetic Heaps

Let Φ(t) be the number of potential events which could occur in a tree t. Then

Φ(t) = external path length

v number of proper descendents of v

v number of proper ancestors of v = number of edges in transitive closure Let ∆(t, x) be the number of descendants of x at time t that will overtake x in the future (that is, at time ≥ t), and let ∆(t) =

x ∆(t, x). Trivially, ∆(t) is at most the number of descendants of x, so ∆(t) ≤ Φ(t).

Let ∆(t, x, y) be the number of descendants of y at time t that will overtake x at time > t. Then ∆(t, x) =

child y of x ∆(t, x, y).

Finally, let t−^ be the old potential of y and let t+^ be the new potential of y.

Consider the following parent-child relationship of nodes x and y, which has the potential to change. The new potential of y after the change can be defined in terms terms of the old potential of x. Also notice that if a descendent of y should overtake y in the future, it must also overtake x in the future.

Suppose at time t, x(t) = y(t) for some x = parent(y).

∆(t−, z) = ∆(t+, z) for all z 6 = x, y ∆(t+, x) = ∆(t−, x, y) − 1 after swap ∆(t+, y) ≤ ∆(t−, y) +

z ∆(t

−, x, z), where z are children of x (before swap), z 6 = y ≤ ∆(t−, y) + ∆(t−, x) − ∆(t−, x, y)

Thus, ∆(t+) ≤ ∆(t−) − 1; that is, every event decreases the potential by 1. We started with potential Φ(t), and thus the number of events after time t is ≤ ∆(t) ≤ Φ(t).

Therefore in the linear-motion case, our efficiency is O(nlog n). Unfortunately, this analy- sis doesn’t work for higher-order motion.

11.3.4 Kinetic Heaps: Customized Flavors

Heater [2]

The basic idea of a heater is to give every object a random key, and keep the keys sorted left to right. In some ways, the data structure is akin to a reverse heap – a node has a priority but also a random search key. A good implementation of a heater is as a binary search tree. Its depth will be O(log n) with high probability. Note also that it is difficult both to split a heater or to merge two heaters.

Hanger [3]

A hanger is built from scratch from the empty set, inserting elements in decreasing order of priorities and using a random coin flip to decide whether to put the element in a left or right subtree. As opposed to heaters, the operations of splitting a tree or merging two trees are trivial to hangers.

11.4 Finding the Closest Pair for Points in the Plane

11.4.1 Using Voronoi Diagrams

Given a set of points in the plane, the closest pair of points can be computed in O(n log n) by using a Voronoi diagram. However, how can one maintain which pair is the closest as the points move around in the plane? There are potentially Ω(n^2 ) changes of which pair is the closest, as illustrated by figure 11.3.

Figure 11.3. If set A moves left, n^2 comparisons will be made with set B

If one considers maintaining the Voronoi diagram, we have a solution that is indeed compact, local-ish (one cell may be complicated, but on average will be O(1)), and responsive. However, its efficiency is Ω(n^2 ) and has thus far been proven to be O(n3+≤) [Micah-Sharir].

11.4.2 Using Yao Graphs [1]

The Yao Graph, Y (P ), is a directed graph with ≤ 6 n edges, where closest pairs create edges. We create this graph by partitioning the plane into six wedges using three lines through a point p which meet at 60◦^ angles. Then “neighbors” of p are found by drawing equilateral triangles in each wedge such that every triangle contains only one other point besides p. We will show the algorithm for maintaining closest pairs for one wedge, and the procedure for other wedges follows symmetrically.

Change of y-coordinate

Find and split and merge, all in O(log n) time.

Figure 11.7. Change of y-coordinate

Change of 60◦-coordinate

  • Hide: Delete from parent(p), insert into p (O(log n) time)
  • Expose: Delete from p, insert into parent(p) (O(log n) time)

Figure 11.8. Change of 60◦-coordinate

Analysis

  • Compact: O(n) space X
  • Local: O(1) - every point in only 6 certificates X
  • Responsive: O(log n) time per event X
  • Efficient: O(n^2 ) events (for psuedo-algebraic motion) X

As a final note, Yao Graphs can be generalized to higher dimensions, though not all cases have been analyzed. For example, in three dimensions, one can consider maintaining on the order of twenty pyramids in place of maintaining six triangles.

Bibliography

[1] Julien Basch*, Leonidas Guibas, and John Hershberger. Data structures for mobile data. J. Algorithms 31(1):1-28, 1999.

[2] Julien Basch, Leonidas Guibas, and G. D. Ramkumar. Reporting red-blue intersec- tions between two sets of conencted line segments. Algorithmica 35:1-20, 2003.

[3] Guilherme D. da Fonseca* and Celina M. H. de Figueiredo. Kinetic heap-ordered trees: tight analysis and faster algorithms. Information Processing Letters 85(3):165-169, 200

[4] Leonidas Guibas. Kinetic data structures. Chapter 23 of Handbook of Data Structures and Applications (Dinesh P. Mehta and Sartaj Sahni, eds.), 23-123-18. Chapman and Hall/CRC, 2005.