1 / 67

Algorithmic Aspects of Searching in the Past

Algorithmic Aspects of Searching in the Past. (Lecture 13: Persistence and Oblivious Data Structures) Advanced Algorithms & Data Structures. Thomas Ottmann Institut für Informatik, Universität Freiburg, Germany ottmann@informatik.uni-freiburg.de. Overview.

keenan
Télécharger la présentation

Algorithmic Aspects of Searching in the Past

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Algorithmic Aspects of Searching in the Past (Lecture 13: Persistence and Oblivious Data Structures) Advanced Algorithms & Data Structures Thomas Ottmann Institut für Informatik, Universität Freiburg, Germany ottmann@informatik.uni-freiburg.de

  2. Overview • Motivation: Oblivious and persistent structures • Examples: Arrays, search trees, Z-stratified search trees, relaxation • Making structures persistent: Structure-copying, path-copying-, DSST-method • Application: Pointlocation • Application: Time-evolving data: Capture and replay of whiteboard data, in particular handwriting traces • Oblivious structures: Randomized and uniquely represented structures, c-level jump lists

  3. Motivation A structure storing a set of keys is called oblivious, if it is not possible to infer its generation history from its current shape. A structure is called persistent, if it supports access to multiple versions. Partially persistent: All versions can be accessed but only the newest version can be modified. Fully persistent: All versions can be accessed and modified. Confluently persistent: Two or more old versions can be combined into one new version.

  4. Example: Arrays Array: 8 15 17 43 47 …… 2 4 Uniquely represented structure, hence, oblivious! Access: In time O(log n) by binary search. Update (Insertion, Deletion): W(n) Caution: Storage structure may still depend on generation history!

  5. 1 5 3 1 7 5 3 7 Example: Natural search trees Only partially oblivious! • Insertion history can sometimes be reconstructed. • Deleted keys are not visible. Access, insertion, deletion of keys may take time W(n) 1, 3, 5, 7 5, 1, 3, 7

  6. Example: Balanced search tree 10 6 15 2 9 11 23 2 5 7 10 11 15 20 30 5 6 7 9 20 23 Problem: Updates come in sudden bursts (Example: Recording ink-traces from pen input) Not enough time to serialize insertions and rebalancing transformations Solution: Relaxed balancing: Carry out updates and rebalancing transformations concurrently!

  7. . . . . Stratified search trees ….. … … … …

  8. Example

  9. Example

  10. Insertion ….. x p . … … . . . ….. … … Insert the new key among the leaves at the expected position and deposit a „push-up-request“

  11. Iterative sequence of insertions

  12. 1 2 3 4 3 4 1 2 Handling of push-up-requests (1) • A push-up-request either leads to a local structural change and halt, which can be carried out in time O(1) (Case 1) • or (exclusively) to a recursive shift of the push-up-requests to the next higher stratum without any structural change (Case 2) Case 1 [There is still room on the next higher stratum] 1 4 3 1 2 3 2 3 1 2 1 2 3 4

  13. Handling of push-up-requests (2) Case 2 [Next higher stratum is full] 1 4 5 1 4 5 2 3 2 3 Append a new apex, if node is pushed over topmost stratum boarder

  14. . . . . Deletion ….. … … … … … … Locate x among the leaves. Deposit a removal request at x. Handle removal request.

  15. Case 1 [Enough nodes at bottommost stratum] Case 2 [Bottommost stratum too sparse] Handling removal requests Deposit „pull-down-request“ p q q

  16. Handling of pull-down-requests (1) Case1 [There are enough nodes on next higher stratum] Finite structural change and Halt! p 1 2 3 p 1 2 3 1 2 p 3 4 p 1 2 3 4 p 1 2 3 4 1 2 p 3 4

  17. Handling of pull-down-requests (2) Case 2 [Not enough nodes on next higher stratum] q q p p Recursively shift pull-down-request to next higher stratum, but no structural change!

  18. Z-stratified search trees: Observations Insertions, deletions, and rebalancing-transformations (removal of , ) can be arbitrarily interleaved. The amortized restructuring costs per insertion or deletion are constant. The generation history of a current version may be partially reconstructed (Sequence of insertions and deletions are partially visible) But: • Update operations are always applied to the current version • Z-stratified search trees are not persistent

  19. Overview • Motivation: Oblivious and persistent structures • Examples: Arrays, search trees, Z-stratified search trees, relaxation • Making structures persistent: Structure-copying, path-copying-, DSST-method • Application: Pointlocation • Application: Time-evolving data: Capture and replay of whiteboard data, in particular handwriting traces • Oblivious structures: Randomized and uniquely represented structures, c-level jump lists

  20. Simple methods for making structures persistent • Copy structure and apply an update-operation to the copy, yields fully persistence at the price of W(n) time per update and space W(m n) for m updates applied to structures of size n. (Structure-copying method) • Do nothing, but store a log-file of all updates! In order to access version i, first carry out i updates, starting with the initial structure, and generate version i. (i) time per access, (m) space for m operations. • Hybrid-method: Store the complete sequence of updates and additionally each k-th version for a suitably chosen k. Result: Time and space requirement increases at least with a faktor sqr(m) ! Are there any better methods? …. for search trees….

  21. Persistent search trees (1) Path-copying method 0 version 0: 5 7 1 3

  22. Persistent search trees (1) Path-copying method 0 1 version 1: Insert (2) 5 5 1 7 1 3 3 2

  23. Persistent search trees (1) Path-copying method 0 1 2 version 1: Insert (2) version 2: Insert (4) 5 5 5 1 1 7 1 3 3 3 2 4

  24. Persistent search trees (1) Path-copying method 0 1 2 version 1: Insert (2) version 2: Insert (4) 5 5 5 1 1 7 1 3 3 3 2 4 Restructuring costs: O(log n) per update operation

  25. k lp t: rp rp Persistent search trees (2) DSST-method: Extend each node by a time-stamped modification box • Modification boxes • initially empty • are filled bottom up ? All versions after time t All versions before time t

  26. DSST method 5 1 7 3 version 0

  27. DSST method 5 1 7 3 version 0: 1 lp 2

  28. DSST method 5 1 7 3 version 1: Insert (2) version 2: Insert (4) 3 1 lp 2 4

  29. DSST method 5 1 7 2 rp 3 version 1: Insert (2) version 2: Insert (4) 3 1 lp 2 4 The amortized costs (time and space) per update operation are O(1)

  30. Overview • Motivation: Oblivious and persistent structures • Examples: Arrays, search trees, Z-stratified search trees, relaxation • Making structures persistent: Structure-copying, path-copying-, DSST-method • Application:Pointlocation • Application: Time-evolving data: Capture and replay of whiteboard data, in particular handwriting traces • Oblivious structures: Randomized and uniquely represented structures, c-level jump lists

  31. Application: Planar Pointlocation Suppose that the Euclidian plane is subdivided into polygons by n line segments that intersect only at their endpoints. Given such a polygonal subdivision and an on-line sequence of query points in the plane, the planar point location problem, is to determine for each query point the polygon containing it. Measure an algorithm by three parameters: 1) The preprocessing time. 2) The space required for the data structure. 3) The time per query.

  32. Planar point location -- example

  33. Planar point location -- example

  34. Solving planar point location (Cont.) Partition the plane into vertical slabs by drawing a vertical line through each endpoint. Within each slab the lines are totally ordered. Allocate a search tree per slab containing the lines at the leaves with each line associate the polygon above it. Allocate another search tree on the x-coordinates of the vertical lines

  35. Solving planar point location (Cont.) To answer query first find the appropriate slab then search the slab to find the polygon

  36. Planar point location -- example

  37. Planar point location -- analysis Query time is O(log n) How about the space ? (n2) And so could be the preprocessing time

  38. Planar point location -- bad example Total # lines O(n), and number of lines in each slab is O(n).

  39. Planar point location & persistence So how do we improve the space bound ? Key observation: The lists of the lines in adjacent slabs are very similar. Create the search tree for the first slab. Then obtain the next one by deleting the lines that end at the corresponding vertex and adding the lines that start at that vertex How many insertions/deletions are there alltogether ? 2n

  40. Planar point location & persistence (cont) Updates should be persistent since we need all search trees at the end. Partial persistence is enough. Well, we already have the path copying method, lets use it. What do we get ? O(n logn) space and O(n log n) preprocessing time. We can improve the space bound to O(n) by using the DSST method.

  41. Overview • Motivation: Oblivious and persistent structures • Examples: Arrays, search trees, Z-stratified search trees, relaxation • Making structures persistent: Structure-copying, path-copying-, DSST-method • Application: Pointlocation • Application: Time-evolving data: Capture and replay of whiteboard data, in particular handwriting traces • Oblivious structures: Randomized and uniquely represented structures, c-level jump lists

  42. Lightweight content creation Time evolving data: Presentation recording • Input media • Whiteboard • TouchScreen • Tablet PC Data sources Author Audience Recorded learning module Document

  43. Pen input, large display Eye contact with audience Cintiq Tablet (Wacom)

  44. Random access facility Access of an ink-object sj corresponding to time tj requires the immediate presentation of sj and of all ink-objects since t0

  45. Whiteboard data Whiteboard data-stream requires • Fast insertion and deletion ofgraphical objects (lines, circles, pen-traces, …) in large quantities, • Partially persistent storage which allows: • Fast access (display and „rendering“) of all data for a given time stamp, • Synchronisability (as slave) with audio-stream (master). Problem: Find a suitable method for storing the whiteboard-action stream!

  46. Postprocessing Whiteboard-stream is made persistent by the structure-copying method: For each time stamp t a complete list of all objects visible on the board at time t is (pre-)computed and stored for random access. Disadvantage: Highly redundant, very large data-volume Advantage: Visible scrolling Storage and representation of freehand ink-traces: Find a suitable compromise between conflicting goals: Data-volume Access cost (time) and dynamic replay (visible scrolling) Individual, personal style Skalability (vector- vs. raster-based-representation)

  47. Overview • Motivation: Oblivious and persistent structures • Examples: Arrays, search trees, Z-stratified search trees, relaxation • Making structures persistent: Structure-copying, path-copying-, DSST-method • Application: Pointlocation • Application: Time-evolving data: Capture and replay of whiteboard data, in particular handwriting traces • Oblivious structures:Randomized and uniquely represented structures, c-level jump lists

  48. Methods for making structures oblivious Unique representation of the structure: • Set/size uniqueness: For each set of n keys there is exactly one structure which can store such a set. • The storage is order unique, i.e. the nodes of the strucure are ordered and the keys are stored in ascending order in nodes with ascending numbers. Randomise the structure: Assure that the expectation for the occurrence of a structure storing a set M of keys is independent of the way how M was generated. Observation: The address-assingment of pointers has to be subject under a randomised regime!

  49. Example of a randomised structure Z-stratified search tree ….. . … … On each stratum, randomly choose the distribution of trees from Z. . . . ….. … … Insertion? Deletion?

  50. 5 1 1 7 3 5 3 7 3 1 5 7 Uniquely represented structures (a) Generation history determines structure 5, 1, 3, 7 1, 3, 5, 7 (b) Set-uniqueness:Set determines structure 1, 3, 5, 7

More Related