Processing an Offline Insertion-Query Sequence with Applications

Slides:



Advertisements
Similar presentations
Polygon Triangulation
Advertisements

Minimum Clique Partition Problem with Constrained Weight for Interval Graphs Jianping Li Department of Mathematics Yunnan University Jointed by M.X. Chen.
Computational Geometry
Longest Common Subsequence
Approximations of points and polygonal chains
UNC Chapel Hill M. C. Lin Polygon Triangulation Chapter 3 of the Textbook Driving Applications –Guarding an Art Gallery –3D Morphing.
Greedy Algorithms Basic idea Connection to dynamic programming Proof Techniques.
Intersections. Intersection Problem 3 Intersection Detection: Given two geometric objects, do they intersect? Intersection detection (test) is frequently.
Rajat K. Pal. Chapter 3 Emran Chowdhury # P Presented by.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Efficient Algorithmic Techniques for Several Multidimensional Geometric Data Management and Analysis Problems Mugurel Ionut Andreica Politehnica University.
Lecture 12 : Special Case of Hidden-Line-Elimination Computational Geometry Prof. Dr. Th. Ottmann 1 Special Cases of the Hidden Line Elimination Problem.
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
Special Cases of the Hidden Line Elimination Problem Computational Geometry, WS 2007/08 Lecture 16 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen,
Vertex Cover, Dominating set, Clique, Independent set
Geometric Data Structures Computational Geometry, WS 2007/08 Lecture 13 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Lecture 11 : More Geometric Data Structures Computational Geometry Prof. Dr. Th. Ottmann 1 Geometric Data Structures 1.Rectangle Intersection 2.Segment.
The Design and Analysis of Algorithms
Data Structures Lecture-1:Introduction
Advanced Algorithm Design and Analysis (Lecture 9) SW5 fall 2004 Simonas Šaltenis E1-215b
1 Geometric Intersection Determining if there are intersections between graphical objects Finding all intersecting pairs Brute Force Algorithm Plane Sweep.
The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each decision is locally optimal. These.
UNC Chapel Hill M. C. Lin Line Segment Intersection Chapter 2 of the Textbook Driving Applications –Map overlap problems –3D Polyhedral Morphing.
The LCA Problem Revisited
Mehdi Mohammadi March Western Michigan University Department of Computer Science CS Advanced Data Structure.
Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.
CMPS 3130/6130 Computational Geometry Spring 2015
Polygon Triangulation
Lecture 20. Graphs and network models 1. Recap Binary search tree is a special binary tree which is designed to make the search of elements or keys in.
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
Lecture: Priority Queue
CMPS 3130/6130 Computational Geometry Spring 2017
3. Polygon Triangulation
Lecture 3: Parallel Algorithm Design
The Design and Analysis of Algorithms
CMPS 3130/6130 Computational Geometry Spring 2017
Data Structures Review Session 2
Vertex Cover, Dominating set, Clique, Independent set
Segment tree and Interval Tree
Computational Geometry Capter:1-2.1
Computing Shortest Path amid Pseudodisks
Representing a Functional Curve by Curves with Fewer Peaks
Computing Maximum Non-Crossing Matching in Convex Bipartite Graphs
Efficient Algorithms for the Weighted k-Center Problem on a Real Line
Danny Z. Chen and Haitao Wang University of Notre Dame Indiana, USA
Dynamic Data Structures for Simplicial Thickness Queries
Locating an Obnoxious Line among Planar Objects
Computing the Visibility Polygon of an Island in a Polygonal Domain
Minimizing the Aggregate Movements for Interval Coverage
Approximating Points by A Piecewise Linear Function: I
Algorithm design (computational geometry)
Haitao Wang Utah State University WADS 2017, St. John’s, Canada
All pairs shortest path problem
An O(n log n)-Time Algorithm for the k-Center Problem in Trees
Optimal Point Movement for Covering Circular Regions
Range Queries on Uncertain Data
Joseph S.B. Mitchell, Stony Brook University
Danny Z. Chen1, Yan Gu2, Jian Li2, and Haitao Wang1
Aggregate-Max Nearest Neighbor Searching in the Plane
Danny Z. Chen and Haitao Wang University of Notre Dame Indiana, USA
Danny Z. Chen and Haitao Wang University of Notre Dame Indiana, USA
Computing Shortest Paths among Curved Obstacles in the Plane
Visibility and Ray Shooting Queries in Polygonal Domains
Outlier Respecting Points Approximation
Approximating Points by A Piecewise Linear Function: II
Weak Visibility Queries of Line Segments in Simple Polygons
L1 Shortest Path Queries among Polygonal Obstacles in the Plane
CS 113: Data Structures and Algorithms
Algorithms and Data Structures Lecture XIV
Presentation transcript:

Processing an Offline Insertion-Query Sequence with Applications Danny Z. Chen and Haitao Wang Dept. of Computer Science and Engineering University of Notre Dame Indiana, USA

Outline Problem definitions Algorithms Applications

Problem Definitions A sorted number set S={a1,a2,…,an} (a1≤a2≤…≤an) in an interval [L,R]; let a0=L, an+1=R Min-gap: min0<i<n+2{ai-ai-1} Max-gap: max0<i<n+2{ai-ai-1} Max-gap L R Min-gap

Problem Definitions (cont.) Min-G-Ins (min-gap of insertions): Input: S, and S0={L,R}, and an offline sequence of insertion operations op1,op2,…,opn; each opj produces a set Sj from Sj-1 by inserting into Sj-1 a number from S\Sj-1 Output: the min-gapδi in Si after every insertion opi

Problem Definitions (cont.) Min-G-Dels (min-gap of deletions): Input: S0=S∪{L,R}, an offline sequence of deletions Max-G-Ins (max-gap of insertions): Output: max-gap of every Sj after each insertion Max-G-Dels (max-gap of deletions)

Problem Definitions (cont.) Ins-Query (insertions with queries): Input: S and X={x1,x2,…,xm} (x1≤x2≤…≤xm) (m=O(n)) in [L,R]; S0={L,R}; an offline mixed sequence of n insertions on S and m queries on X Output: For each query with query value xj, report its predecessor, pre(Si, xi), and its successor, suc(Si, xj), where Si is the set produced by all insertions preceding the query. Del-Query (deletions with queries): All insertions above are deletions; S0=S∪{L,R}.

Previous Work For all problems: O(nlog n) time, by balanced binary tree O(nloglog n) time, by integer data structure (because the universal set is S)

A Related Problem A problem of Aho, Hopcroft and Ullman: Input: S=Ø, and an offline sequence of insertion and extract-min operations, where each insertion inserts an integer i in [1,n] into S, and each extract-min finds the minimum value in S and remove it; each integer in [1,n] is inserted at most once. Output: The integers returned by all extract-min operations. Solution: Solvable in linear time. Different from our problem in the following sense: Our problems are not restricted to integers. The output in our problems is min-gap rather than the minimum number. There are queries in our problems. Use different algorithmic techniques.

Our Solutions Linear time for all problems By geometric modeling and the application of Gabow and Tarjan’s special case linear time union-find data structure

Min-G-ins (min-gap of insertions) Geometric modeling: If the j-th insertion is on ai, then create a point pi=(ai,j) in the plane For each point pi, create a line segment by connecting pi to the horizontal line y=n+1 y j x ai

An Example of Geometric Modeling y (a4,6) (a5,5) (a2,4) (a6,3) (a1,2) (a3,1) x

An Observation For each point pi, if we shoot a horizontal ray to its left, let the x-coordinate of the segment which is hit first by the ray, called hit segment, be li. If the j-th insertion is on ai, then the predecessor of ai in Sj-1, pre(Sj-1,ai), is li

An Example of the Observation y (a4,6) L (a5,5) (a2,4) R (a6,3) (a1,2) (a3,1) x

An Observation (cont.) For each point pi, if we shoot a ray to its right, let the x-coordinate of the hit segment be ri. If the j-th insertion is on ai, then the successor of ai in Sj-1, suc(Sj-1,ai), is ri.

An Example of the Observation (cont.) y (a4,6) L (a5,5) (a2,4) R (a6,3) (a1,2) (a3,1) x

An Observation (cont.) The insertion of ai produces two (smaller) gaps ai-pre(Sj-1,ai) and suc(Sj-1,ai)-ai Suppose we know δi-1; then the min-gap of Sj is min{δi-1 , ai-pre(Sj-1,ai), suc(Sj-1,ai)-ai} the insertion of ai pre(Sj-1,ai) suc(Sj-1,ai)

An Observation (cont.) Key issue: Compute li and ri for each ai Our approach: A simple sweeping from left to right using a stack.

The Algorithm Let bi be the length of the segment induced by pi, and let b0=bn+1=n+1. For each bi, 0<i<n+1, compute li=ak1 where k1=max{ t | t<i and bt>bi} and ri=ak2 where k2=min{ t | t>i and bt>bi} For each i, compute ci=min{ai-li,ri-ai} Set δ0=R-L. For j=1 to n, compute δj=min{δj-1,cg(j)}, where g(j) is the index of the number inserted in the j-th insertion

Ins-Query (Insertions with queries) Geometric modeling: If the j-th operation is on ai, then create a data point pi=(ai,j) in the plane If the j-th operation is on a query value xi, then create a query point qi=(xi,j) in the plane For each data point, create a vertical segment by connecting it to the horizontal line y=m+n+1

An Example of Geometric Modeling y (x2,6) (a3,5) (x1,4) (a4,3) (a1,2) (a2,1) x

An Observation For each query point qj, if we shoot a horizontal ray to its left, then the x-coordinate of the hit segment is the predecessor of xi; if we shoot a horizontal ray to its right, then the x-coordinate of the hit segment is the successor of xi; It is sufficient to solve the ray shooting problem.

An Example of the Ray Shooting

A Sweeping Algorithm Sweep the plane by a horizontal line from y=m+n+1 to y=0 while maintaining all segments intersecting the sweeping line. All points are events Data point event: remove the corresponding segment Query point event: search its hit segment Key issue: A dynamic data structure is needed to maintain all the segments intersecting the sweeping line and to search the hit segment for each query point

A Solution Maintaining the segments intersecting the sweeping line is equivalent to maintaining a set of sub-intervals on [L,R] Gabow and Tarjan’s linear time special case union-find data structure can be applied.

sweeping line moving downward Initially sweeping line moving downward y (a3,6) (a4,5) (x2,4) (a1,3) (x1,2) (a2,1) x Interval set: {[L,a1],[a1,a2] ,[a2,a3],[a3,a4],[a4,R]} x1 is in [a1,a2] and x2 is in [a3,a4]

A Data Point (a3,6) is Swept y (a3,6) (a4,5) (x2,4) (a1,3) (x1,2) (a2,1) x Interval set: {[L,a1],[a1,a2] ,[a2,a4],[a4,R]} x1 is in [a1,a2] and x2 is in [a2,a4]

A Data Point (a4,5) is Swept y (a3,6) (a4,5) (x2,4) (a1,3) (x1,2) (a2,1) x Interval set: {[L,a1],[a1,a2] ,[a2,R]} x1 is in [a1,a2] and x2 is in [a2,R]

A Data Point (x2,4) is Swept y (a3,6) (a4,5) (x2,4) (a1,3) (x1,2) (a2,1) x Interval set: {[L,a1],[a1,a2] ,[a2,R]} x2 is in [a2,R], so its predecessor is a2 and its successor is R

Other Problems The problems Min-G-Del, Max-G-Ins, Max-G-Del and Del-Query can all be solved in linear time by slight modifications on the previous two algorithms.

Applications Horizontal ray shooting Given a set S of n vertical line segments and a set P of n points in the plane, the segments and points are sorted in two lists by their x-coordinates and y-coordinates, respectively Shoot a horizontal ray from each point in P to its left and report the segment in S hit first by the ray Our solution: O(nlog k) time by applying our algorithm on Ins-Query problem and using interval tree data structure, where k is the minimum number of cliques of the corresponding interval graph for the input vertical segments.

Horizontal Ray Shooting

Applications (cont.) Shortest Arc Covering Given a set P of n positions on a circle in a cyclic order, and an offline sequence of insertions each of which inserts a point at an available position (the position then becomes unavailable) Report the shortest circular arc which covers all points on the circle after each insertion. Our solution: O(n) time by reducing the problem to the Max-G-Ins problem.

Shortest Arc Covering

Thank you!