790 likes | 921 Views
Survey and Proposal on Binary Search Algorithms for Longest Prefix Match. Author : Hyesook Lim, Member, IEEE, and Nara Lee, Student Member, IEEE Publisher : IEEE COMMUNICATIONS SURVEYS & TUTORIALS Presenter: Yu Hao , Tzeng Date : 2012/10/03. Outline. Introdution Trie -based Algorithms
E N D
Survey and Proposal on Binary Search Algorithms for Longest Prefix Match Author: Hyesook Lim, Member, IEEE, and Nara Lee, Student Member, IEEE Publisher: IEEE COMMUNICATIONS SURVEYS & TUTORIALS Presenter: Yu Hao, Tzeng Date: 2012/10/03
Outline • Introdution • Trie-based Algorithms • Algorithms Performing Binary Search on Prefix Values • Algorithms Performing Binary Search on Prefix Lengths • Performance • Conclusion
Introdution • Describe various IP address lookup algorithms and compare the characteristics. • Use a consistent example set to describe the data structure and the search procedure of each algorithm • Evaluate each algorithm in terms of the minimum, worst-case, and average-case number of memory accesses, as well as memory requirements
Trie-based Algorithms • Binary Trie (B-Trie) • Path-Compressed Trie (PC-Trie) • Priority Trie (P-Trie)
Trie-based Algorithms (Cont.) • Binary Trie (B-Trie) • Path-Compressed Trie (PC-Trie) • Priority Trie (P-Trie)
Trie-based Algorithms (Cont.) 0 • Binary Trie (B-Trie) 1 2 3 4 5 6 7 8 9 10 P2 11 12 P0 13 P1 P5 P4 P6 P3
Trie-based Algorithms (Cont.) 0 • Binary Trie (B-Trie) 1 2 3 4 5 6 7 8 9 10 P2 11 12 P0 13 P1 P5 P4 P6 P3
Trie-based Algorithms (Cont.) 0 • Binary Trie (B-Trie) • Example • Input : 110100 • Path : 0 -> 2 -> 5 -> 7 -> 9 -> 11 -> NULL • Best matching prefix (BMP) : P2 -> P4 1 2 3 4 5 6 7 8 9 10 P2 11 12 P0 13 P1 P5 P4 P6 P3
Trie-based Algorithms (Cont.) • Binary Trie (B-Trie) • Path-Compressed Trie (PC-Trie) • Priority Trie (P-Trie)
Trie-based Algorithms (Cont.) 0 0 • Path-Compressed Trie (PC-Trie) • Use skip values to remove single-child empty internal nodes • Remove a child pointer by converting the sub-trie of each node into a full trie 1 1 2 2 3 3 4 4 5 6 6 7 7 8 8 9 10 9 12 P2 P2 11 12 P0 P0 P1 13 P4 P1 P5 P5 P6 P4 P3 Skip 1 P6 Skip 1 Skip 1 P3 Skip 1
Trie-based Algorithms (Cont.) 0 • Path-Compressed Trie (PC-Trie) 1 2 3 4 6 7 8 9 12 P2 P0 P1 P4 P5 P6 P3 Skip 1 Skip 1 Skip 1 Skip 1
Trie-based Algorithms (Cont.) 0 • Path-Compressed Trie (PC-Trie) • References [7] 1 2 3 4 5 6 7 8 0 9 10 1 P2 1 2 11 12 3 2 P2 P0 3 4 6 5 13 5 4 P4 P5 P1 P0 P1 P5 7 8 P3 P6 P4 P6 P3
Trie-based Algorithms (Cont.) • Path-Compressed Trie (PC-Trie) • References [7] 0 1 1 2 3 2 P2 3 4 6 5 5 4 P4 P5 P1 P0 7 8 P3 P6
Trie-based Algorithms (Cont.) • Path-Compressed Trie (PC-Trie) • References [7] • Example • Input : 110100 • Path : 0 -> 2 -> 5 -> 7 • BMP : P2 -> P4 0 1 1 2 3 2 P2 3 4 6 5 5 4 P4 P5 P1 P0 7 8 P3 P6
Trie-based Algorithms (Cont.) • Binary Trie (B-Trie) • Path-Compressed Trie (PC-Trie) • Priority Trie (P-Trie)
Trie-based Algorithms (Cont.) 0 0 • Priority Trie (P-Trie) • relocate the longest prefix belonging to the sub-trie of each empty internal node into the empty node to remove empty internal nodes in the binary trie 1 1 2 2 3 3 4 5 4 6 5 7 6 8 9 10 P2 P2 11 12 P3 P0 P0 13 P1 P1 P5 P5 P4 P6 P4 P6 P3
Trie-based Algorithms (Cont.) 0 • Priority Trie (P-Trie) 1 2 3 4 5 6 P2 P3 P0 P1 P5 P6 P4
Trie-based Algorithms (Cont.) 0 • Priority Trie (P-Trie) • Example • Input : 110100 • Path : 0 -> 2 -> 4 -> 5 • BMP : P2 -> P4 1 2 3 4 5 6 P2 P3 P0 P1 P5 P6 P4
Algorithms Performing Binary Search on Prefix Values • Binary Search on Range (BSR) • Binary Search Tree (BST) • Weighted Binary Search Tree (WBST) • Binary Search Tree with Prefix Vector (BST-PV) • Binary Search Tree with Switch Pointer (BST-SP)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search on Range (BSR) • Binary Search Tree (BST) • Weighted Binary Search Tree (WBST) • Binary Search Tree with Prefix Vector (BST-PV) • Binary Search Tree with Switch Pointer (BST-SP)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search on Range (BSR)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search on Range (BSR)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search on Range (BSR) • Example • Input : 110100 • BMP : P4
Algorithms Performing Binary Search on Prefix Values (Cont.)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search on Range (BSR) • Binary Search Tree (BST) • Weighted Binary Search Tree (WBST) • Binary Search Tree with Prefix Vector (BST-PV) • Binary Search Tree with Switch Pointer (BST-SP)
Algorithms Performing Binary Search on Prefix Values (Cont.) 0 • Binary Search Tree (BST) 1 2 3 4 5 6 P1 P2 P0 P4 P5 P3 P6
Algorithms Performing Binary Search on Prefix Values (Cont.) 0 • Binary Search Tree (BST) 1 2 3 4 5 6 P1 P2 P0 P4 P5 P3 P6
Algorithms Performing Binary Search on Prefix Values (Cont.) 0 • Binary Search Tree (BST) • Example • Input : 110100 • Path : 0 -> 2 -> 3 -> 4 • BMP : P2 -> P4 1 2 3 4 5 6 P1 P2 P0 P4 P5 P3 P6
Algorithms Performing Binary Search on Prefix Values (Cont.)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search on Range (BSR) • Binary Search Tree (BST) • Weighted Binary Search Tree (WBST) • Binary Search Tree with Prefix Vector (BST-PV) • Binary Search Tree with Switch Pointer (BST-SP)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Weighted Binary Search Tree (WBST) • Define the weight of a prefix, as the number of enclosed prefixes plus 1
Algorithms Performing Binary Search on Prefix Values (Cont.) • Weighted Binary Search Tree (WBST) 0 P2 1 2 P0 P4 3 4 5 P1 P3 P5 6 P6
Algorithms Performing Binary Search on Prefix Values (Cont.) • Weighted Binary Search Tree (WBST) • Example • Input : 110100 • Path : 0 -> 2 -> 4 • Output port : P2 -> P4 0 P2 1 2 P0 P4 3 4 5 P1 P3 P5 6 P6
Algorithms Performing Binary Search on Prefix Values (Cont.)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search on Range (BSR) • Binary Search Tree (BST) • Weighted Binary Search Tree (WBST) • Binary Search Tree with Prefix Vector (BST-PV) • Binary Search Tree with Switch Pointer (BST-SP)
Algorithms Performing Binary Search on Prefix Values (Cont.) 0 • Binary Search Tree with Prefix Vector (BST-PV) • prefix vectors are constructed for each leaf prefix of the binary trie • the leaf prefixes with a prefix vector are sorted in ascending order 1 2 3 4 5 6 7 8 9 10 P2 11 12 P0 13 P1 P5 P4 P6 P3
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search Tree with Prefix Vector (BST-PV) • prefix vectors are constructed for each leaf prefix of the binary trie • the leaf prefixes with a prefix vector are sorted in ascending order
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search Tree with Prefix Vector (BST-PV) • Example • Input : 110100 • Path : 0 -> 1 • BMP : P4 0 1 2 3
Algorithms Performing Binary Search on Prefix Values (Cont.)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search on Range (BSR) • Binary Search Tree (BST) • Weighted Binary Search Tree (WBST) • Binary Search Tree with Prefix Vector (BST-PV) • Binary Search Tree with Switch Pointer (BST-SP)
Algorithms Performing Binary Search on Prefix Values (Cont.) 0 • Binary Search Tree with Switch Pointer (BST-SP) 1 2 3 4 5 6 7 8 9 10 3 P2 P3 11 12 1 5 P0 P1 P5 13 4 6 0 2 P1 P5 P0 P4 P2 P6 P4 P6 P3
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search Tree with Switch Pointer (BST-SP) 3 P3 1 5 P1 P5 4 6 0 2 P0 P4 P2 P6
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search Tree with Switch Pointer (BST-SP) • Search • Best matching prefix (BMP) • Best matching length (BML) • Current matching enclosure length (CMEL) • Switch pointer (SP)
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search Tree with Switch Pointer (BST-SP) • Example I • Input : 110100 3 P3 1 5 P1 P5 4 6 0 2 P0 P4 P2 P6
Algorithms Performing Binary Search on Prefix Values (Cont.) • Binary Search Tree with Switch Pointer (BST-SP) • Example II • Input : 111000 3 P3 1 5 P1 P5 4 6 0 2 P0 P4 P2 P6
Algorithms Performing Binary Search on Prefix Values (Cont.)
Algorithms Performing Binary Search on Prefix Lengths (Cont.) • Waldvogels Binary Search on Length (W-BSL) • Binary Search on Length in a Leaf-Pushed Trie (L-BSL) • logW-Elevator Algorithm (logW-E) • Binary Search on Lengths in Multiple Tries (BSL-MT)