Transcript
Page 1: Cache-Oblivious Red-BlueBlue Line Segment Intersectiong · intersections between a red segment and a blue segment. Common assumption: No two segments of the samme color intersect:

Cache-Oblivious Red-BlueCache-Oblivious Red-Blue Motivation CaMotivation Ca

Line Segment intersection External memLine Segment intersection External mem2D line segment intersection problems are well studied topics in computational geometry CPU: Computa2D line segment intersection problems are well studied topics in computational geometry. CPU: Computa

Three common problem types: Memory: FiniteThree common problem types:Disk: ElementsGeneral : Find all intersections between segments in a set Disk: Elements

Red Bl e Gi en t o sets of line segments the red set and the bl e set find allRed-Blue : Given two sets of line segments, the red set and the blue set, find all i t ti b t d t d bl t

CPUintersections between a red segment and a blue segment.

Common assumption: No two segments of the samme color intersectCommon assumption: No two segments of the samme color intersect.

Orthogonal : Given a set of axis-parallel line segments, find all intersections.g p g ,

Cache-obliviCache-obliviIn the cache-obIn the cache obRAM model buRAM model bu

R lt Al ithResult: Algorithmemory hierarc

Orthogonal Red-Blue Generalg

Al ith b dAlgorithm based o

Contribution 1 S li l iContribution 1. Split plane into

This work solves the Red-Blue line segment intersection problem in the cache-obliviousThis work solves the Red Blue line segment intersection problem in the cache obliviousmodel 2. Recurse on eacmodel.

least one endpoThe table below shows what’s been done previously for the three problems above. Note that all of the given bounds are optimal, except for the general external memory intersection 3. Use k-mergerg p p g yproblem. Our solution is highlighted in red.p g g

3.1. Intersecti

3.2. IntersectInternal Memory External Memory Cache-Oblivious

O th lOrthogonaluu

( )Red-Blue

l(u)Red Blue

General OpenGe e a Openσl(u)

MADALGO Center for Massive Data Algorithmics aMADALGO – Center for Massive Data Algorithmics, a

Th M lhThomas MølhaveAarhus UniversityAarhus University

Line Segment IntersectionLine Segment Intersectiongache-Oblivious Model The k-Mergerache Oblivious Model The k Merger

mory model k-merger: merges k sorted streams of total length at least k2mory model k merger: merges k sorted streams of total length at least k .

P d dation Can only access elements in memory

Produces a sorted output stream.ation. Can only access elements in memory.

Structure: Perfectly balanced binary tree with, holds M elements.

Structure: Perfectly balanced binary tree withk leaves and buffers on the edges

s transferred to/from disk in block of size Bk leaves and buffers on the edges.

B ff i d fi d i l b littis transferred to/from disk in block of size B. Buffer sizes defined recursively by splitting√The k-merger into √k-mergers. √

kEach internal node is a binary mergerMemory size M Disk

√kEach internal node is a binary merger.

Block size BBlock size B

ous modelous model √k

√k

√kblivious model algorithms are designed in the

√k

√k

√kblivious model algorithms are designed in the

ut analyzed in the external memory modelut analyzed in the external memory model.

h th t ffi i t ll l lhms that are efficient on all levels on any chy .

Algorithm O er ieAlgorithm Overview

di id d t h ion divide and conquer technique:

√N l b i h √N d i i h l b√N slabs with √N endpoints in each slab.

ch slab to find intersections between segments with at oint in the slab.

r multiple times to find:b1

r1b1r1

ons between short and long segments of different colors.

b4r2tions between long red and long blue segments. b3b4r2

b2

b3b2

σ1 σ2 σ3 σ4 σ5 σ6 σ8σ7

R fReferences( )r(u)

Performing steps 3.1 and 3.2 requires [1] L. Arge, T. Mølhave, N. Zeh, Cache-Oblivious Red-Blue Line bb1

significant changes to the binary mergers Segment Intersection. In Proc. ESA, pp. 88-99, 2008.[2] G S B d l R F b C h bli i di t ib ti i

b2

b3

of the k-merger. [2] G.S. Brodal, R. Fagerberg. Cache oblivious distribution sweeping. In Proc ICALP pp 426 438 2002

b4

In Proc. ICALP, pp. 426–438, 2002.[3] L Arge D E Vengroff J S Vitter External-memory algorithms for

r[3] L. Arge, D.E. Vengroff, J.S. Vitter. External memory algorithms for

processing line segments in geographic information systems. σr(u) p g g g g p y

Algorithmica, 47:1–25, 2007.

a Center of the Danish National Research Foundationa Center of the Danish National Research Foundation

Top Related