Persistent Data Structures Computational Geometry, WS 2007/08 Lecture 12 Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen, Institut.

Slides:



Advertisements
Similar presentations
Planar point location -- example
Advertisements

Introduction to Computer Science 2 Lecture 7: Extended binary trees
Line Segment Intersection Computational Geometry, WS 2007/08 Lecture 3 – Supplementary Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut.
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
Dynamic Planar Convex Hull Operations in Near- Logarithmic Amortized Time TIMOTHY M. CHAN.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
1 Persistent data structures. 2 Ephemeral: A modification destroys the version which we modify. Persistent: Modifications are nondestructive. Each modification.
Comp 335 File Structures Indexes. The Search for Information When searching for information, the information desired is usually associated with a key.
Convex Hulls Computational Geometry, WS 2007/08 Lecture 2 – Supplementary Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
1 Algorithmic Aspects of Searching in the Past Christine Kupich Institut für Informatik, Universität Freiburg Lecture 1: Persistent Data Structures Advanced.
CS 171: Introduction to Computer Science II
Dynamic Algorithms for Planar Point Location Kanat Tangwongsan in collaboration with Guy Blelloch, Umut Acar, Srinath Sridhar. Aladdin Center - Summer.
Convex Hulls Computational Geometry, WS 2006/07 Lecture 2 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
Klee’s Measure Problem Computational Geometry, WS 2007/08 Group Work Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen, Institut.
The Half-Edge Data Structure Computational Geometry, WS 2007/08 Lecture 3, Part III Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen,
Linear Programming Computational Geometry, WS 2006/07 Lecture 5, Part IV Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Orthogonal Range Searching Computational Geometry, WS 2006/07 Lecture 13 – Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
The Half-Edge Data Structure
Delaunay Triangulation Computational Geometry, WS 2006/07 Lecture 11 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Line Segment Intersection Computational Geometry, WS 2007/08 Lecture 3 – Part I Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Multiversion Access Methods - Temporal Indexing. Basics A data structure is called : Ephemeral: updates create a new version and the old version cannot.
Orthogonal Range Searching 3Computational Geometry Prof. Dr. Th. Ottmann 1 Orthogonal Range Searching 1.Linear Range Search : 1-dim Range Trees 2.2-dimensional.
WS Prof. Dr. Th. Ottmann Algorithmentheorie 16 – Persistenz und Vergesslichkeit.
Parallel Prefix Computation Advanced Algorithms & Data Structures Lecture Theme 14 Prof. Dr. Th. Ottmann Summer Semester 2006.
I/O-Algorithms Lars Arge Aarhus University February 27, 2007.
The Lower Envelope: The Pointwise Minimum of a Set of Functions Computational Geometry, WS 2006/07 Lecture 4 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen,
Update 1 Persistent Data Structures (Version Control) v0v0 v1v1 v2v2 v3v3 v4v4 v5v5 v6v6 Ephemeral query v0v0 v1v1 v2v2 v3v3 v4v4 v5v5 v6v6 Partial persistence.
Lecture 12 : Special Case of Hidden-Line-Elimination Computational Geometry Prof. Dr. Th. Ottmann 1 Special Cases of the Hidden Line Elimination Problem.
Computational Geometry, WS 2007/08 Lecture 15 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften.
Branch and Bound Similar to backtracking in generating a search tree and looking for one or more solutions Different in that the “objective” is constrained.
Special Cases of the Hidden Line Elimination Problem Computational Geometry, WS 2007/08 Lecture 16 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen,
Duality and Arrangements Computational Geometry, WS 2007/08 Lecture 6 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Orthogonal Range Searching Computational Geometry, WS 2006/07 Lecture 13 – Part III Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
Linear Programming Computational Geometry, WS 2007/08 Lecture 7 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
I/O-Algorithms Lars Arge University of Aarhus March 1, 2005.
1 Algorithmic Aspects of Searching in the Past Thomas Ottmann Institut für Informatik, Universität Freiburg, Germany
I/O-Algorithms Lars Arge Spring 2009 March 3, 2009.
1 Geometric Solutions for the IP-Lookup and Packet Classification Problem (Lecture 12: The IP-LookUp & Packet Classification Problem, Part II) Advanced.
Geometric Data Structures Computational Geometry, WS 2007/08 Lecture 13 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
I/O-Algorithms Lars Arge Aarhus University March 5, 2008.
Hidden-Line Elimination Computational Geometry, WS 2006/07 Lecture 14 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
Closest Pair of Points Computational Geometry, WS 2006/07 Lecture 9, Part II Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen,
Polygon Triangulation Computational Geometry, WS 2007/08 Lecture 9 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Linear Programming Computational Geometry, WS 2006/07 Lecture 5, Part III Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Orthogonal Range Searching Computational Geometry, WS 2006/07 Lecture 13 - Part I Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
1 Persistent data structures. 2 Ephemeral: A modification destroys the version which we modify. Persistent: Modifications are nondestructive. Each modification.
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
Lecture 11 : More Geometric Data Structures Computational Geometry Prof. Dr. Th. Ottmann 1 Geometric Data Structures 1.Rectangle Intersection 2.Segment.
1 Indexing Structures for Files. 2 Basic Concepts  Indexing mechanisms used to speed up access to desired data without having to scan entire.
Polygon Triangulation Computational Geometry, WS 2006/07 Lecture 8, Part 2 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Linear Programming Computational Geometry, WS 2006/07 Lecture 5, Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Line Segment Intersection Computational Geometry, WS 2006/07 Lecture 3 – Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Art Gallery Theorem Computational Geometry, WS 2006/07 Lecture 8, Part 1 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Duality and Arrangements Computational Geometry, WS 2006/07 Lecture 7 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Line Segment Intersection Computational Geometry, WS 2006/07 Lecture 3 – Part I Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
AALG, lecture 11, © Simonas Šaltenis, Range Searching in 2D Main goals of the lecture: to understand and to be able to analyze the kd-trees and.
Binary Trees Chapter 6.
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
14/13/15 CMPS 3130/6130 Computational Geometry Spring 2015 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry.
Chapter 6 Binary Trees. 6.1 Trees, Binary Trees, and Binary Search Trees Linked lists usually are more flexible than arrays, but it is difficult to use.
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
Line Segment Intersection Computational Geometry, WS 2006/07 Lecture 3 – Part III Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
Review 1 Queue Operations on Queues A Dequeue Operation An Enqueue Operation Array Implementation Link list Implementation Examples.
CMPS 3130/6130 Computational Geometry Spring 2015
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Tree-Structured Indexes Chapter 10.
Michal Balas1 I/O-efficient Point Location using Persistent B-Trees Lars Arge, Andrew Danner, and Sha-Mayn Teh Department of Computer Science, Duke University.
Computational Geometry
Persistent Data Structures (Version Control)
Presentation transcript:

Persistent Data Structures Computational Geometry, WS 2007/08 Lecture 12 Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften Albert-Ludwigs-Universität Freiburg

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann2 Overview Versions and persistence in data structures Making structures persistent Partial persistence –Fat node method –Path-copying method –Node-copying (DSST) method Revisit: Planar point-location –Sarnak-Tarjan solution –Dobkin-Lipton observation

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann3 Data Structures in the Temporal Sense A data structure is called Ephemeral – no mechanisms to revert to previous states. –Usually, a single transitory structure where a change to the structure destroys the old version. Persistent – supports access to multiple versions. Furthermore, a structure is – partially persistent if all versions can be accessed but only the newest version can be modified, and – fully persistent if every version can be both accessed and modified.

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann4 A Linked Data Structure Pre-definitions: A linked data structure has a finite collection of nodes. Each node contains a fixed number of named fields. All nodes in the structure are of exactly the same type Access to the linked structure is by pointers indicating nodes of the structure. In our deliberations: We shall use the binary search tree as our linked data structure for all running examples throughout the lecture.

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann5 Persisted Versions Versions are directly related to the operations incurred on the data structure, mainly: Update operations Access operations After an update operation, the current and all previous states of the data structure are archived in a manner that makes them accessible (via access operations) from their version identities.

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann6 Terminologies Current version – Version v i of the data structure where a current operation is about to be performed Current operation – An update operation performed on the current version v i of the data structure, which will result in the newest version v i+1, spawned after a successful completion of the operation.

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann7 Making Structures Persistent: Naïve I Naïve Structure-Copy Method Make a copy of the data structure each time it is changed At current operation: –A new version v i+1 is spawned by completely copying the current version –The update operation is performed on the newest version Costs (for structure of size n): –Per update: TimeSpace –For m updates: TimeSpace

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann8 Making Structures Persistent: Naïve II Naïve Log-File Method Store a log-file of all updates At current operation: –Update log-file To access version i: –Sequentially carry out i updates, starting from the initial structure, to generate version i. Costs (for structure of size n): –Per update: TimeSpace –For m updates: TimeSpace –Per access:Time

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann9 Hybrid Method Structure-Copying with Log-file Store the complete sequence of updates in a log-file Store every k th version of the data structure, for a suitably chosen k To access version i: –Retrieve structure from version k  i/k  –Sequentially update structure to get version i Tradeoffs from Log-file method: –Time and space requirement increase at least with a factor of

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann10 Ideals We seek more efficient techniques: Ideally, we want (on average) to have Storage space used by the persistent structure to be O(1) per update step, and Time per operation to increase by only a constant factor over the time in the ephemeral structure

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann11 Fat Node Method – Partial Persistence Record all changes made to the node field in the nodes themselves Nodes are allowed to become arbitrarily “fat” to include version history; i.e. a list of version stamps A version stamp indicates the version in which the named field was changed to the specified value Each fat node has its own version stamp to indicate the version in which it was created However, a version stamp is not unique; i.e. several Fat nodes can have the same version stamp

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann12 Update Operation – Fat Node Method Consider update operation i. Persistent (Fat Node Method) Creates new Fat node with version stamp i, and all original field values Store field value plus version stamp Ephemeral Creates new node Changes a field

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann13 Update Operation – Example (Versions 1 to 9) Insert: 5, 20, 8, 15, 6, 2, 1, 28, (Versions 10 to 12) Delete: 20, 5, 1

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann14 Access Operation – Fat Node Method Accessing any version i  m in the persistent structure: Find the root node at version i. Then traverse nodes in the structure, choosing only version values with the maximum version stamp  i. Example: Given this persistent structure, access version v v 1 -v 10 v6v6 v7v7 v2v2 v3v3 v4v4 v5v5 v8v8 v9v9 v 10 v 11 v 12 v 11 -v 12

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann15 Analysis – Fat Node Method Assumption: The version stamps in a Fat node are ordered and stored in a balanced binary search tree. Update operation Space per update: Time per update: Access operation Time per access: (multiplicative slow-down)

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann16 Path-Copying Method – Partial Persistence Creates a set of search trees, one per update, having different roots but sharing common subtrees Copy only the nodes in which changes are made, such that any node in the current version that contains a pointer to a node must itself be copied In our linked data structure, each node contains pointers to its children Copying one node in the current version requires copying the entire path from the node to the root – hence the name “Path-Copying”

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann17 Update Operation – Path-Copying Consider update operation i. Identify the node in the current version that will be affected by the update operation Make a copy of this node (and hence the path to the root in the current version) Modify the path accordingly to the operation

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann18 Update Operation – Example (Insert) (Versions 1 to 9) Insert: 5, 20, 8, 15, 6, 2, 1, 28, … v 7

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann19 Update Operation – Example (Insert) (Versions 1 to 9) Insert: 5, 20, 8, 15, 6, 2, 1, 28, … v v8v8

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann20 Update Operation – Example (Insert) (Versions 1 to 9) Insert: 5, 20, 8, 15, 6, 2, 1, 28, … v v8v8 5 v9v9 8 15

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann21 Update Operation – Example (Delete) (Versions 10 to 12) Delete: 1, 20, … v

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann22 Update Operation – Example (Delete) (Versions 10 to 12) Delete: 1, 20, … v v 10

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann23 Update Operation – Example (Delete) (Versions 10 to 12) Delete: 1, 20, … v v 10 5 v

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann24 Update Operation – Example (Delete) (Versions 10 to 12) Delete: 1, 20, … v v 10 5 v v 12

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann25 Access Operation – Path-Copying Assumption: The version roots are ordered and stored in some accessible structure on top of all the m persisted versions. To access any version v i : We only need to locate the correct root from the accessible top structure to access the required version i

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann26 Analysis – Path-Copying Method Update operation Space per update: Time per update: Access operation Time per access:

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann27 Node-Copying Method – Partial Persistence An improvement to the Fat node method We do not allow nodes to become arbitrarily “fat”, but fix this number When we run out of space for version stamps, we then create a new copy of the node In our deliberation, we allow only 1 additional pointer, contained in the node and call it the version stamp modification box. k lprp v t : ptr Original left pointer to left child with version before v t Original right pointer to right child with version before v t Version stamp modification box

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann28 Update Operation – Node-Copying Consider update operation i. Identify the node in the current version that will be affected by the update operation Make a copy of this node if the version stamp modification box is not empty Modify the node accordingly to the operation

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann29 Update Operation – Example (Insert) v0v (Versions 1 to 6) Insert: 15, 6, 2, 1, 28, 12

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann30 Update Operation – Example (Insert) v0v v 2 : lp 8 v 1 : rp (Versions 1 to 6) Insert: 15, 6, 2, 1, 28,

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann31 Update Operation – Example (Insert) v 0 -v 4 5 v 3 : lp 20 v 2 : lp 8 v 1 : rp (Versions 1 to 6) Insert: 15, 6, 2, 1, 28, v 6 : lp 862 v 4 : lp v 5 -v 6 12

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann32 Update Operation – Example (Delete) v 0 -v 4 5 v 3 : lp 20 v 2 : lp 8 v 1 : rp (Versions 7 and 8) Delete: 1, v 6 : lp 862 v 4 : lp v 5 -v 6 12

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann33 Access Operation – Node-Copying Navigating through this persistent structure is exactly the same as the Fat node method. To access any version v i : Find the root node at version i. Then traverse nodes in the structure, choosing only version values with the maximum version stamp  i. Exercise: From the previous figure, access version v 6

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann34 Analysis – Node-Copying Method Update operation Space per update: Time per update: Access operation Time per access:

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann35 Planar Point Location

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann36 Planar Point Location: Sarnak-Tarjan Solution Idea: (partial) persistence –Query time: O(log n), Space: O(n) –Relies on Dobkin-Lipton construction and Cole’s observation. Dobkin-Lipton: –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, and with each line associate the polygon above it. –Allocate another search tree on the x-coordinates of the vertical lines.

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann37 Dobkin-Lipton Construction Partition the plane into vertical slabs.

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann38 Dobkin-Lipton Construction Locate a point with two binary searches. Query time: O(log n). Nice but space inefficient! Can cause O(n 2 ).

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann39 Worst-Case Example Θ(n) segments in each slabs, and Θ(n) slabs.

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann40 Cole’s Observation A B Sets of line segments intersecting contiguous slabs are similar. Reduces the problem to storing a “persistent” sorted set.

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann41 Improving the Space Bound 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. Total number of insertions / deletions: –2n –One insertion and one deletion per segment.

Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann42 Planar Point Location and Persistence Updates should be persistent (since we need all search trees at the end). Partial persistence is enough (Sarnak and Tarjan). Method 1: Path-copying method; simple and powerful (Driscoll et al., Overmars). –O(n log n) space + O(n log n) preprocessing time. Method 2: Node-copying method –We can improve the space bound to O(n).