Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "IP-Lookup and Packet Classification, II Advanced Algorithms & Data Structures Lecture Theme 8 Prof. Dr. Th. Ottmann Summer Semester 2006."— Presentation transcript:

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

2 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

3 3 128.9.16.0/21 128.9.172.0/21 128.9.176.0/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. 0 2 32 -1 128.9.0.0/16 142.12.0.0/19 65.0.0.0/8 128.9.16.14 LMP-Matching

4 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 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 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 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 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 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 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 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 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 13 8 3, 8 3245 6, 9 671 2, 4 1 4, 5 3 5, 4 57 1, 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 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 15 Finding topmost leftmost points in PST

16 16 Finding leftmost topmost points in PST

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

18 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, 2 25 3 4 5 1 7 2 2 1 6 1 4 8, 33, 82, 74, 55, 46, 97, 11, 2 25 3 4 5 1 7 2 2 1 6 1 4 1

19 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).

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

21 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 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 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 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 25 18, 9 18 4, 10 3 13, 5 10 16, 4 15 3, 4 1 9, 13 7 14, 8 13 20, 6 16 7, 8 4 10, 2 14 1, 3 9 15, 1 20 5, 2 5 Example: insertion of (5, 2)

26 26 18, 9 18 4, 10 3 13, 5 10 16, 4 15 3, 4 1 9, 13 7 14, 8 13 20, 6 16 7, 8 4 10, 2 14 1, 3 9 15, 1 20 5, 2 5 Example: insertion of (5, 2)

27 27 18, 9 18 4, 10 3 13, 5 10 16, 4 15 3, 4 1 9, 13 7 14, 8 13 20, 6 16 7, 8 4 10, 2 14 5, 2 9 15, 1 20 1, 3 5 Example: insertion of (5, 2)

28 28 18, 9 18 4, 10 3 13, 5 10 16, 4 15 3, 4 1 9, 13 7 14, 8 13 20, 6 16 1, 3 4 10, 2 14 5, 2 9 15, 1 20 7, 8 5 Example: insertion of (5, 2)

29 29 18, 9 18 4, 10 3 13, 5 10 16, 4 15 3, 4 1 9, 13 7 14, 8 13 20, 6 16 1, 3 4 10, 2 14 5, 2 9 15, 1 20 7, 8 5 Example: insertion of (5, 2)

30 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 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 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 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.

34 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.

35 35 051015 051015 Conflict detection (1)

36 36 vu u v Conflict detection (2)

37 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 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 39 2 W - 1 - v 2 W - 1 - u uv 2 W - 1 Lu/Sahni-Solution

40 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 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 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.


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

Similar presentations


Ads by Google