IP-Lookup and Packet Classification, II Advanced Algorithms & Data Structures Lecture Theme 8 Prof. Dr. Th. Ottmann Summer Semester 2006.

Slides:



Advertisements
Similar presentations
Priority search queues: Loser trees
Advertisements

1 IP-Lookup and Packet Classification Advanced Algorithms & Data Structures Lecture Theme 08 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
Chapter 4: Trees Part II - AVL Tree
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
I/O-Algorithms Lars Arge Fall 2014 September 25, 2014.
B+-Trees (PART 1) What is a B+ tree? Why B+ trees? Searching a B+ tree
Binary Trees, Binary Search Trees CMPS 2133 Spring 2008.
Constant-Time LCA Retrieval
AA Trees another alternative to AVL trees. Balanced Binary Search Trees A Binary Search Tree (BST) of N nodes is balanced if height is in O(log N) A balanced.
Balanced Search Trees. 2-3 Trees Trees Red-Black Trees AVL Trees.
Orthogonal Range Searching 3Computational Geometry Prof. Dr. Th. Ottmann 1 Orthogonal Range Searching 1.Linear Range Search : 1-dim Range Trees 2.2-dimensional.
I/O-Algorithms Lars Arge Aarhus University February 27, 2007.
IP Address Lookup for Internet Routers Using Balanced Binary Search with Prefix Vector Author: Hyesook Lim, Hyeong-gee Kim, Changhoon Publisher: IEEE TRANSACTIONS.
Orthogonal Range Searching-1Computational Geometry Prof. Dr. Th. Ottmann 1 Orthogonal Range Searching 1.Linear Range Search : 1-dim Range Trees 2.2-dimensional.
CSC311: Data Structures 1 Chapter 10: Search Trees Objectives: Binary Search Trees: Search, update, and implementation AVL Trees: Properties and maintenance.
1 Trees. 2 Outline –Tree Structures –Tree Node Level and Path Length –Binary Tree Definition –Binary Tree Nodes –Binary Search Trees.
I/O-Algorithms Lars Arge University of Aarhus March 1, 2005.
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.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Part B Part A:  Index Definition in SQL  Ordered Indices  Index Sequential.
© 2006 Pearson Addison-Wesley. All rights reserved11 A-1 Chapter 11 Trees.
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part II Prof. Dr. Th. Ottmann Summer Semester 2006.
IP-Lookup and Packet Classification Computational Geometry, WS 2007/08 Lecture 14 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für.
Lecture 11 : More Geometric Data Structures Computational Geometry Prof. Dr. Th. Ottmann 1 Geometric Data Structures 1.Rectangle Intersection 2.Segment.
Data Structures Using C++ 2E Chapter 11 Binary Trees and B-Trees.
Homework #3 Due Thursday, April 17 Problems: –Chapter 11: 11.6, –Chapter 12: 12.1, 12.2, 12.3, 12.4, 12.5, 12.7.
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.
Bioinformatics Programming 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Orthogonal Range Searching I Range Trees. Range Searching S = set of geometric objects Q = query object Report/Count objects in S that intersect Q Query.
1 Efficient packet classification using TCAMs Authors: Derek Pao, Yiu Keung Li and Peng Zhou Publisher: Computer Networks 2006 Present: Chen-Yu Lin Date:
Chapter Tow Search Trees BY HUSSEIN SALIM QASIM WESAM HRBI FADHEEL CS 6310 ADVANCE DATA STRUCTURE AND ALGORITHM DR. ELISE DE DONCKER 1.
Chapter 19: Binary Trees. Objectives In this chapter, you will: – Learn about binary trees – Explore various binary tree traversal algorithms – Organize.
UNC Chapel Hill M. C. Lin Orthogonal Range Searching Reading: Chapter 5 of the Textbook Driving Applications –Querying a Database Related Application –Crystal.
External Memory Algorithms for Geometric Problems Piotr Indyk (slides partially by Lars Arge and Jeff Vitter)
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
Chapter 13 B Advanced Implementations of Tables – Balanced BSTs.
Chapter 11 Heap. Overview ● The heap is a special type of binary tree. ● It may be used either as a priority queue or as a tool for sorting.
2IL50 Data Structures Fall 2015 Lecture 9: Range Searching.
Fall 2006 CSC311: Data Structures 1 Chapter 10: Search Trees Objectives: Binary Search Trees: Search, update, and implementation AVL Trees: Properties.
Chapter 7 Trees_Part3 1 SEARCH TREE. Search Trees 2  Two standard search trees:  Binary Search Trees (non-balanced) All items in left sub-tree are less.
3.1. Binary Search Trees   . Ordered Dictionaries Keys are assumed to come from a total order. Old operations: insert, delete, find, …
Binary Search Trees (BSTs) 18 February Binary Search Tree (BST) An important special kind of binary tree is the BST Each node stores some information.
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
1 Joe Meehean. A A B B D D I I C C E E X X A A B B D D I I C C E E X X  Terminology each circle is a node pointers are edges topmost node is the root.
CSE 2331/5331 Topic 8: Binary Search Tree Data structure Operations.
Heaps © 2010 Goodrich, Tamassia. Heaps2 Priority Queue ADT  A priority queue (PQ) stores a collection of entries  Typically, an entry is a.
BINARY TREES Objectives Define trees as data structures Define the terms associated with trees Discuss tree traversal algorithms Discuss a binary.
1/20/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Plane Sweep Algorithms I Carola Wenk.
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
Priority Search Trees Keys are distinct ordered pairs (x i, y i ). Basic operations.  get(x,y) … return element whose key is (x,y).  delete(x,y) … delete.
AA Trees.
BCA-II Data Structure Using C
Red-Black Trees v z Red-Black Trees Red-Black Trees
CMPS 3130/6130 Computational Geometry Spring 2017
Lecture 22 Binary Search Trees Chapter 10 of textbook
B+ Tree.
CMPS 3130/6130 Computational Geometry Spring 2017
Orthogonal Range Searching and Kd-Trees
Priority Search Trees Keys are pairs (x,y).
Binary Search Trees < > =
Red-Black Trees v z /20/2018 7:59 AM Red-Black Trees
Red-Black Trees v z Red-Black Trees Red-Black Trees
Segment Trees Basic data structure in computational geometry.
Ch. 8 Priority Queues And Heaps
Priority Search Trees Modified Prof. Sahni’s notes.
Topic 6: Binary Search Tree Data structure Operations
Chapter 12 Heap ADT © 2011 Pearson Addison-Wesley. All rights reserved.
CS210- Lecture 20 July 19, 2005 Agenda Multiway Search Trees 2-4 Trees
Presentation transcript:

IP-Lookup and Packet Classification, II Advanced Algorithms & Data Structures Lecture Theme 8 Prof. Dr. Th. Ottmann Summer Semester 2006

2 Overview  The IP-table lookup problem  Geometric interpretation of the problem  Solution using Priority Search Trees  Solution using min augmented range trees, loser trees

/ / /24 Routing lookup: Find the longest matching prefix (the most specific route) among all prefixes that match the destination address. Geometric view: For a given point p, find the smallest interval stabbed by p / / / LMP-Matching

4 Mapping intervals to points Assumption: All points have pairwise distinct x-coordinates Map point (x, y) to ((x, – y), y) Interval (l, r) is mapped to point (r, l) below the main diagonal.

5 Disjoint intervals B A B A X and Y represent disjoint intervals ⇔ There is no point p on the diagonal, s.t. p ≼ X und p ≼ Y

6 Geometric interpretation of interval-inclusion A B A B A ⊒ B Interval A = (l A, r A ) includes interval B = (l B, r B ) iff. point A is right below point B A ⋟ B B ⊑ A ⇔ A ⊒ B ⇔ p oint B left above point A ⇔ B ≼ A

7 Overlapping intervals C p D C D X and Y represent overlapping intervals ⇔ There is a point p on the diagonal, s.t. p ≼ X and p ≼ Y, but X and Y are incomparable with resp. to ≼

8 Nested intervals B C A B p A D C X is smallest intervall, that contains point p ⇔ p ≼ X and for all Y with p ≼ Y : X ≼ Y Observation: Sets of nested intervals stabbed by a point are totally ordered with resp. to ≼ Points closer to the diagonal represent smaller intervals. D

9 Equivalent Query For a given p, find the leftmost point whose x-value is greater than or equal to p and whose y-value is less than or equal to p. p p Since the original intervals are nested, the topmost-leftmost point is also the leftmost one!

10 Geometric view of IP-table lookup Find a representation of a (dynamic) set of intervals such that the following operations can be carried out efficiently: Insertion of an interval Deletion of an interval For a given point p: Find the smallest interval stabbed by p (LMP-query) Assumptions: Set of intervals is a nested set. Every newly inserted interval does not overlap with any interval in the set. Conflict test: For a given interval test whether or not it overlaps (is in conflict) with any interval already in the set.

11 Geometric Solution of the IP-lookup-problem Maintain a set of points in the plane (below the main diagonal) s.t. the following operations can be carried out efficiently: insertion of points deletion of points minXinRectagle queries (corresponds to topmost-leftmost queries) minXinRectangle(l, r, y 0 ) Data structures used: Priority-search-trees (Lu/Sahni, IEEE TC, 2004) Min-augmented-search-trees Priority-search-pennats (Lauer, Ottmann, Datta: Update efficient data structures for dynamic IP router tables, IJFCS, to appear)

12 Priority Search Trees Priority Search trees are a 1.5-dim structure for the storage of points, they support the following operations : Insertion of a point Deletion of a point South-grounded range queries

13 8 3, , , 4 1 4, 5 3 5, , 2 2 8, 3 6 7, 1 4 Priority Search Tree Priority search trees are - binary leaf search trees for the x-coordinates of the points. - min heaps for the y-coordinates of the points.

14 l y0y0 r Executable in O(log n) time. minXinRectangle(l, r, y 0 ) Find topmost leftmost (or leftmost topmost) point in the range (l, r, y 0 ) p l y0y0 Well defined, if intervalls are nested, otherwise not! r

15 Finding topmost leftmost points in PST

16 Finding leftmost topmost points in PST

17 Balanced trees as skeletons of PSTs  Rotation preserves the x-order, but may destroy the y-order of points.

18 Min-augmented range trees Two data structures in one: Leaf-search tree on x-coordinates of points Min-tournament tree on y-coordinates of points 8, 33, 82, 74, 55, 46, 97, 11, , 33, 82, 74, 55, 46, 97, 11,

19 MinXinRectangle(l, r, y 0 ) lr Split node Search for the boundary values l, r. Find the leftmost umbrella node with a min-field ≤ y 0. Proceed to the left son of the current node, if its min-field is ≤ y 0, and to the right son, otherwise. Return the point at the leaf. MinXinRectangle(l, r, y 0 ) can be found in time O(height of tree).

Maintaining min-fields under rotations x´= x v´= min {w, y}

21 Topped loser tree n nodes for n elements still a search tree but: no heap! I D P Italien 1 Niederlande 3 Argentinien 2Spanien 4 Deutschland 5Frankreich 6Polen 7USA 8 U A F NS

22 Topped loser tree The tree is a semi-heap: each node dominates one of its subtrees (the subtree where it originally came from) To see where a node came from, check its split key! I D P Italien 1 Niederlande 3 Argentinien 2Spanien 4 Deutschland 5Frankreich 6Polen 7USA 8 U A F NS

23 D, 5 A F, 6 F P, 7 N U, 8 S A, 2 D S, 4 P N, 3 I U, 8F, 6D, 5I, 1N, 3P, 7S, 4A, 2 I, 1 U Priority search pennant (Hinze 2001) label  key strength  priority

24 3, 82, 44, 55, 46, 9 7, 1 1, 2 2, 4 1 3, 8 3 6, 9 5 4, 5 2 5, 4 6 1, 2 4 7, 1 8 Example with points in plane key = x-coordinate priority = y-coordinate

25 18, , , , , 4 1 9, , , , , , , , 2 5 Example: insertion of (5, 2)

26 18, , , , , 4 1 9, , , , , , , , 2 5 Example: insertion of (5, 2)

27 18, , , , , 4 1 9, , , , , , , , 3 5 Example: insertion of (5, 2)

28 18, , , , , 4 1 9, , , , , , , , 8 5 Example: insertion of (5, 2)

29 18, , , , , 4 1 9, , , , , , , , 8 5 Example: insertion of (5, 2)

30 Comparison: PST - PSP Priority Search Tree (s. McCreight 1985) Binary leaf search tree for x-coordinates Min-heap for y-coordinates Insertion, Deletion of points: O(log n) Range query: O(log n + k) where k is the size of the answer Min-X-in-Rectangle:O(log n) Priority Search Pennant (s. Hinze 2001) Binary leaf search tree for x-coordinates Semi-heap for y-coordinates Insertion, Deletion of points: O(log n) Range query: Θ(k·(log n - log k + 1)) where k is the size of the answer Min-X-in-Rectangle:???

31 MinXinRectangle(x left, x right, y top ) query Let Min store the best node that has been found so far. Examine node N: 1)If N satisfies the search condition (x left ≤ x N < x Min AND y N ≤ y top ), set Min = N. 2)Proceed with N.left only if necessary, i.e. if a)the left subtree contains big enough x-values: s N ≥ x left AND b)the left subtree may contain small enough y-values: y N ≤ y top OR N originates from its right subtree 3)Proceed with N.right only if necessary, i.e. if c)the right subtree contains small enough x-values: s N < x Min AND d)the right subtree may contain small enough y-values: y N ≤ y top OR N originates from its left subtree  depth-first search (in preorder) with pruning

32 MinXinRectangle-query MinXinRectangle (xleft, xright, ytop) Min = dummy_node(xright); inspect (root, xleft, ytop); return Min inspect(N, xleft, ytop) if (y N  ytop AND x N  xleft AND x N  x Min ) Min = N; (1) if s N  xleft AND (y N  ytop OR x N > s N )) inspect(N.left, xleft, ytop); (2) if s N < x Min AND (y N  ytop OR x N  s N ) inspect(N.right, xleft, ytop) A node satisfying (1) and (2) during its first visit (in the preorder traversal of nodes) is called a potential fork. A node is an actual fork, if both of ist children are inspected during the search.

33 Lemma: Let N be a fork for MinXinRectangle(x left, x right, y top ). Then there are no potential (or actual) forks in the right (left) subtree. The „winning“ point of each subtree is found in a node W outside that subtree! Theorem: There is at most one fork on the search path of a MinXinRectangle(x left, x right, y top ) query carried out on a PSP.

MART,PSP – Summary Theorem: Min-augmented Range trees and Priority-search pennants allow to represent a dynamic set S of n points in the plane with the following properties: The data structure allows updates and to answer MinXinRectangle(l, r, y 0 ) queries in O(log n) time. The data structures occupy O(n) space. Note: The data structures can be based on an arbitrary scheme of balanced binary leaf search trees. PSP and MARTs can be used (instaed of PST) to solve the dynamic version of the IP lookup problem without changing the time complexity of the lookup and update operations.

Conflict detection (1)

36 vu u v Conflict detection (2)

37 vu u v Existence of left-overlapping range x y u v (y, x) Check whether minXinRectangle(u, v-1, u-1) exists

38 vu u v Existence of right-overlapping range x y u v (y, x) u  x ≤ v  y Query range not south-grounded! Query: Does the range contain a point with ordinate-value  u?

39 2 W v 2 W u uv 2 W - 1 Lu/Sahni-Solution

40 v u u v Existence of right-overlapping range Check whether minXinRectangle(v+1, , v) returns a point P s.t. y P  u x y u v u  x ≤ v  y Note: Leftmost point in range is also topmost one!

41 Comparison of PST, MART, and PSP PSTMARTPSP Size for n points2n-1 nodes n nodes Node size3 fields2 fields3 fields Single rotationO(log n)O(1) BalancingRestrictedFlexible Maximum height2 · (log 2 n + 1)1.44… · (log 2 n + 1)1.44… · log 2 n + 1

42 Further work Experimental comparison of PST, MART, PSP for IP lookup Decouple updates, restructurings (rotations), and lookup operations Use a different tie-breaking rule (arbitrary priorities instead of most specific rule) Extension to higher dimensions Conflict detection: 1 dim: general ranges (not nested) 2 dim Find output sensitiver solution for offline problem: report all conflicts in a given set of ranges, online problem: report all conflicts with a query range.