Download presentation
Presentation is loading. Please wait.
1
Dynamic rectangular intersection with priorities
K, Molad, Tarjan
2
Related classical problem: Range reporting
Given a set of intervals S on the line, preprocess them to build a structure that allows efficient queries of the from: Given a point x find all intervals containing it. x
3
Range reporting + priorities
Given a set of intervals S on the line, each with priority assigned to it, build a structure that allows efficient queries of the from: Given a point x find interval with minimum priority containing it. Updates – insert or delete an interval 9 5 3 1 7 x
4
Motivation – Packet classification
B Forward to Interface A Forward to Interface B 1 2 3 block block & report to Bill This problem can be stated as follows: The basic task of a router is to classify incoming packets into streams, and to handle each stream in a certain way. A good way of doing that is to define intervals on the ip of the sender. In this way, a packet with a sender which falls into a certain interval can be forwarded to an interface… Or forwarded to another interface… Or maybe blocked. What happens when the packet falls into 2 intervals? We need priorities to decide. IP address
5
Nested intervals, ip prefixes
190.0.*.* 190.1.*.* * block Forward to Interface A Forward to Interface B 2 3 IP address
6
Extension to 2D Query = point in R2 interval = rectangle with priority
(Sender IP, receiver IP) interval = rectangle with priority 5 9 7
7
One dimensional data structure for nested intervals
4 5 2 9 2 7 1
8
Nested Intervals Containment tree:
4 5 2 9 2 7 1 Containment tree: The parent of interval v is the smallest interval containing v 2 7 1 2 9 5 4
9
Nested Intervals Query:
4 5 2 9 2 7 1 Query: Starting node s = smallest interval containing the query point Relevant priorities are on the path from s to the root. 2 7 1 2 9 5 Problem: path may be long… 4
10
Hey, dynamic trees know how to do that
4 5 2 9 2 7 1 We can use a dynamic tree to represent the containment tree. 2 7 1 Problem: Updates => Many cuts & links 2 9 5 4
11
Insert
12
Binarization Node v => node v
4 5 2 9 2 7 1 Node v => node v Leftmost child of v => Left child of v 9 7 5 ∞ Adjust costs: Left edge => priority of parent Right edge => ∞ 2 7 1 Any other child of v => right child of its left sibling 2 9 5 4
13
Insert (Cont.) Constant number of links and cuts
14
Summary Containment tree C Represent C by binarized version B
Query = min cost on path from starting point to root Represent C by binarized version B Represent B by dynamic tree D How do you find the point to start the query ? How do you find the edges to cut ?
15
How do you start the query ?
4 2 9 5 2 7 1 Use a balanced search tree on the endpoints 7 1 9 Min(Mincost( ), pri( ))
16
query (cont) 4 2 9 5 2 7 1 7 1 9 Mincost( )
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.