CMPS 3130/6130 Computational Geometry Spring 2017

Slides:



Advertisements
Similar presentations
Introduction to Algorithms
Advertisements

Two Segments Intersect?
Computational Geometry
Line Segment Intersection. Balanced binary search tree Internal nodes: Rightmost leaf in its left subtree Status Structure T.
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
2/3/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Triangulations and Guarding Art Galleries II Carola Wenk.
9/12/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries II Carola Wenk.
1 Voronoi Diagrams. 2 Voronoi Diagram Input: A set of points locations (sites) in the plane.Input: A set of points locations (sites) in the plane. Output:
1 Closest Points A famous algorithmic problem... Given a set of points in the plane (cities in the U.S., transistors on a circuit board, computers on a.
9/5/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Plane Sweep Algorithms and Segment Intersection Carola Wenk.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Convex Hulls Today: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness,
17. Computational Geometry Chapter 7 Voronoi Diagrams.
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.
1 Geometric Intersection Determining if there are intersections between graphical objects Finding all intersecting pairs Brute Force Algorithm Plane Sweep.
Chapter 12. Binary Search Trees. Search Trees Data structures that support many dynamic-set operations. Can be used both as a dictionary and as a priority.
External Memory Algorithms for Geometric Problems Piotr Indyk (slides partially by Lars Arge and Jeff Vitter)
14/13/15 CMPS 3130/6130 Computational Geometry Spring 2015 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry.
2IL50 Data Structures Fall 2015 Lecture 9: Range Searching.
Preview  Graph  Tree Binary Tree Binary Search Tree Binary Search Tree Property Binary Search Tree functions  In-order walk  Pre-order walk  Post-order.
2/19/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Voronoi Diagrams Carola Wenk Based on: Computational Geometry:
Segment Trees Basic data structure in computational geometry. Computational geometry.  Computations with geometric objects.  Points in 1-, 2-, 3-, d-space.
CMPS 3130/6130 Computational Geometry Spring 2015
UNC Chapel Hill M. C. Lin Computing Voronoi Diagram For each site p i, compute the common inter- section of the half-planes h(p i, p j ) for i  j, using.
Priority Search Trees Keys are pairs (x,y). Basic (search, insert, delete) and rectangle operations. Two varieties.  Based on a balanced binary search.
CMPS 3130/6130 Computational Geometry Spring 2015
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
1/20/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Plane Sweep Algorithms I Carola Wenk.
COSC 2007 Data Structures II Chapter 13 Advanced Implementation of Tables II.
May 2012Range Search Algorithms1 Shmuel Wimer Bar Ilan Univ. Eng. Faculty Technion, EE Faculty.
CMPS 3130/6130 Computational Geometry Spring 2017
Binary Search Trees What is a binary search tree?
Computational Geometry
Lecture 15 Nov 3, 2013 Height-balanced BST Recall:
AA Trees.
File Organization and Processing Week 3
Multiway Search Trees Data may not fit into main memory
Tree-Structured Indexes: Introduction
CMPS 3130/6130 Computational Geometry Spring 2017
Binary Search Trees.
Red Black Trees
CMPS 3130/6130 Computational Geometry Spring 2017
Multiway search trees and the (2,4)-tree
AVL DEFINITION An AVL tree is a binary search tree in which the balance factor of every node, which is defined as the difference between the heights of.
Algorithm design techniques Dr. M. Gavrilova
Lecture 7 Algorithm Analysis
KD Tree A binary search tree where every node is a
(edited by Nadia Al-Ghreimil)
Orthogonal Range Searching and Kd-Trees
CPSC 531: System Modeling and Simulation
Chapter 6 Transform and Conquer.
Priority Search Trees Keys are pairs (x,y).
Lecture 26 Multiway Search Trees Chapter 11 of textbook
B+ Trees What are B+ Trees used for What is a B Tree What is a B+ Tree
Computational Geometry Capter:1-2.1
Search Sorted Array: Binary Search Linked List: Linear Search
Segment Trees Basic data structure in computational geometry.
Tree Representation Heap.
B-Tree.
Lecture 7 Algorithm Analysis
Lecture 7 Algorithm Analysis
(edited by Nadia Al-Ghreimil)
CMPS 3130/6130 Computational Geometry Spring 2017
CMPS 3130/6130 Computational Geometry Spring 2017
Search Sorted Array: Binary Search Linked List: Linear Search
CS 6310 Advanced Data Structure Wei-Shian Wang
Data Structures and Algorithm Analysis Priority Queues (Heaps)
Binary Search Trees Comp 122, Spring 2004.
Chapter 12&13: Binary Search Trees (BSTs)
Algorithms and Data Structures Lecture XIV
Red Black Trees Colored Nodes Definition Binary search tree.
Presentation transcript:

CMPS 3130/6130 Computational Geometry Spring 2017 Plane Sweep Algorithms I Carola Wenk 1/24/17 CMPS 3130/6130 Computational Geometry

CMPS 3130/6130 Computational Geometry Closest Pair Problem: Given PR2, |P|=n, find the distance between the closest pair in P 1/24/17 CMPS 3130/6130 Computational Geometry

Plane Sweep: An Algorithm Design Technique Simulate sweeping a vertical line from left to right across the plane. Maintain cleanliness property: At any point in time, to the left of sweep line everything is clean, i.e., properly processed. Sweep line status: Store information along sweep line Events: Discrete points in time when sweep line status needs to be updated 1/24/17 CMPS 3130/6130 Computational Geometry

Plane Sweep: An Algorithm Design Technique Simulate sweeping a vertical line from left to right across the plane. Maintain cleanliness property: At any point in time, to the left of sweep line everything is clean, i.e., properly processed. Sweep line status: Store information along sweep line Events: Discrete points in time when sweep line status needs to be updated Algorithm Generic_Plane_Sweep: Initialize sweep line status S at time x=- Store initial events in event queue Q, a priority queue ordered by x-coordinate while Q ≠  // extract next event e: e = Q.extractMin(); // handle event: Update sweep line status Discover new upcoming events and insert them into Q 1/24/17 CMPS 3130/6130 Computational Geometry

Plane sweep for Closest Pair Problem: Given PR2, |P|=n, find the distance of the closest pair in P Sweep line status: Store current distance Δ of closest pair of points to the left of sweep line Store points in Δ-strip left of sweep line Store pointer to leftmost point in strip Events: All points in P. No new events will be added during the sweep. → Presort P by x-coordinate. Cleanliness property 1/24/17 CMPS 3130/6130 Computational Geometry

Plane sweep for Closest Pair, II O(n log n) Presort P by x-coordinate How to store points in Δ-strip? Store points in Δ-strip left of sweep line in a balanced binary search tree, ordered by y-coordinate → Add point, delete point, and search in O(log n) time Event handling: New event: Sweep line advances to point pP Update sweep line status: Delete points outside Δ-strip from search tree by using previous leftmost point in strip and x-order on P Compute candidate points that may have distance  Δ from p: Perform a search in the search tree to find points in Δ–strip whose y-coordinates are at most Δ away from p.y. → Δ x 2Δ rectangle Because of the cleanliness property each pair of these points has distance ≥Δ. → A Δ x 2Δ rectangle can contain at most 6 such points. Check distance of these points to p, and possibly update Δ No new events necessary to discover O(n log n) total 1 2 O(n log n + 6n) total O(6n) total 3 Δ Total runtime: O(n log n) Δ 1/24/17 CMPS 3130/6130 Computational Geometry Δ

Balanced Binary Search Tree -- a bit different 17 43 1 6 8 12 14 26 35 41 42 59 61 key[x] is the maximum key of any leaf in the left subtree of x. 1/24/17 CMPS 3130/6130 Computational Geometry

Balanced Binary Search Tree -- a bit different x  x > x 17 8 42 1 14 35 43 6 12 17 26 41 43 59 1 6 8 12 14 26 35 41 42 59 61 key[x] is the maximum key of any leaf in the left subtree of x. 1/24/17 CMPS 3130/6130 Computational Geometry

CMPS 3130/6130 Computational Geometry Balanced Binary Search Tree -- a bit different x  x > x 17 8 42 1 12 8 14 17 26 35 41 14 35 43 6 12 17 26 41 43 59 1 6 8 12 14 26 35 41 42 59 61 RANGE-QUERY([7, 41]) 1/24/17 CMPS 3130/6130 Computational Geometry

CMPS 3130/6130 Computational Geometry General 1D range query root split node 1/24/17 CMPS 3130/6130 Computational Geometry

Plane Sweep: An Algorithm Design Technique Plane sweep algorithms (also called sweep line algorithms) are a special kind of incremental algorithms Their correctness follows inductively by maintaining the cleanliness property Common runtimes in the plane are O(n log n): n events are processed Update of sweep line status takes O(log n) Update of event queue: O(log n) per event 1/24/17 CMPS 3130/6130 Computational Geometry