2019/9/3 Adaptive Hashing Based Multiple Variable Length Pattern Search Algorithm for Large Data Sets 比對 Simple Pattern 的方法是基於 Hash 並且可以比對不同長度的 Pattern。 2015 IEEE Conference on Network Function Virtualization and Software Defined Network (ICDSE) Author: Punit Kanuga, Anamika Chauhan Presenter: Cheng-Feng Ke Date: 2017/09/27 Department of Computer Science and Information Engineering National Cheng Kung University, Taiwan R.O.C. CSIE CIAL Lab 1
Find Minimum Pattern Length 2019/9/3 INTRODUCTION Simple Pattern scare scar arch Find Minimum Pattern Length Create Hash Table Create Match Table National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Find Minimum Pattern Length 2019/9/3 Find Minimum Pattern Length scare (Length = 5) scar (Length = 4) arch (Length = 5) Min Length 4 National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Create Hash Table Patterns: scare、scar 、arch Min Length 4 Hash Table 2019/9/3 Min Length 4 Create Hash Table Patterns: scare、scar 、arch Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Create Match Table Patterns: scare、scar 、arch sc、ca、ar、re、rc、ch 2019/9/3 Min Length 4 Create Match Table Patterns: scare、scar 、arch sc、ca、ar、re、rc、ch Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Match Table Key Values HASH(sc) HASH(ca) HASH(ar) HASH(re) HASH(rc) HASH(ch) National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Create Match Table Patterns: scare、scar 、arch sc => scare、scar 2019/9/3 Min Length 4 Create Match Table Patterns: scare、scar 、arch sc => scare、scar Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Match Table Key Values HASH(sc) (0) HASH(ca) HASH(ar) HASH(re) HASH(rc) HASH(ch) National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Create Match Table Patterns: scare、scar 、arch sc => scare、scar 2019/9/3 Min Length 4 Create Match Table Patterns: scare、scar 、arch sc => scare、scar Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Match Table Key Values HASH(sc) (0, 1) HASH(ca) HASH(ar) HASH(re) HASH(rc) HASH(ch) 1 2 3 4 s c a r e National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Create Match Table Patterns: scare、scar 、arch sc => scare、scar 2019/9/3 Min Length 4 Create Match Table Patterns: scare、scar 、arch sc => scare、scar Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Match Table Key Values HASH(sc) (0, 1, 1, 3) HASH(ca) HASH(ar) HASH(re) HASH(rc) HASH(ch) 1 2 3 s c a r e National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Create Match Table Patterns: scare、scar 、arch sc => scare、scar 2019/9/3 Min Length 4 Create Match Table Patterns: scare、scar 、arch sc => scare、scar Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Match Table Key Values HASH(sc) (0, 1, 1, 3), (1,1,1,2) HASH(ca) (0,2,2,2), (1,2,2,1) HASH(ar) (0,3,3,1), (1,3,3,0),(2,1,1,2) HASH(re) (0,4,4,0), HASH(rc) (2,2,2,1) HASH(ch) (2,3,3,0) 1 2 3 s c a r National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Search Min Length 4 4 - 2 = 2 Hash Table Index Hash Value HASH(scare) 2019/9/3 Min Length 4 Search 4 - 2 = 2 Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Input String -2 -1 1 2 3 4 5 6 7 8 a r e s c h ● Match Table Key Values HASH(sc) (0, 1, 1, 3), (1,1,1,2) HASH(ca) (0,2,2,2), (1,2,2,1) HASH(ar) (0,3,3,1), (1,3,3,0),(2,1,1,2) HASH(re) (0,4,4,0) HASH(rc) (2,2,2,1) HASH(ch) (2,3,3,0) National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Search Min Length 4 Hash Table Index Hash Value HASH(scare) 1 2019/9/3 Min Length 4 Search Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Input String -2 -1 1 2 3 4 5 6 7 8 a r e s c h ● 2 - 4 = -2 Match Table Key Values HASH(sc) (0, 1, 1, 3), (1,1,1,2) HASH(ca) (0,2,2,2), (1,2,2,1) HASH(ar) (0,3,3,1), (1,3,3,0),(2,1,1,2) HASH(re) (0,4,4,0) HASH(rc) (2,2,2,1) HASH(ch) (2,3,3,0) National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Search Min Length 4 Hash Table Index Hash Value HASH(scare) 1 2019/9/3 Min Length 4 Search Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Input String -2 -1 1 2 3 4 5 6 7 8 a r e s c h ● Match Table Key Values HASH(sc) (0, 1, 1, 3), (1,1,1,2) HASH(ca) (0,2,2,2), (1,2,2,1) HASH(ar) (0,3,3,1), (1,3,3,0),(2,1,1,2) HASH(re) (0,4,4,0) HASH(rc) (2,2,2,1) HASH(ch) (2,3,3,0) 2 + 4 – 1 = 5 National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Search Min Length 4 Hash Table Index Hash Value HASH(scare) 1 2019/9/3 Min Length 4 Search Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Input String -2 -1 1 2 3 4 5 6 7 8 a r e s c h ● Match Table Key Values HASH(sc) (0, 1, 1, 3), (1,1,1,2) HASH(ca) (0,2,2,2), (1,2,2,1) HASH(ar) (0,3,3,1), (1,3,3,0),(2,1,1,2) HASH(re) (0,4,4,0) HASH(rc) (2,2,2,1) HASH(ch) (2,3,3,0) National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Search Min Length 4 Hash Table Index Hash Value HASH(scare) 1 2019/9/3 Min Length 4 Search Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Input String -2 -1 1 2 3 4 5 6 7 8 a r e s c h ● Match Table Key Values HASH(sc) (0, 1, 1, 3), (1,1,1,2) HASH(ca) (0,2,2,2), (1,2,2,1) HASH(ar) (0,3,3,1), (1,3,3,0),(2,1,1,2) HASH(re) (0,4,4,0) HASH(rc) (2,2,2,1) HASH(ch) (2,3,3,0) National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Search Min Length 4 Hash Table Index Hash Value HASH(scare) 1 2019/9/3 Min Length 4 Search Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Input String -2 -1 1 2 3 4 5 6 7 8 a r e s c h ● Match Table Key Values HASH(sc) (0, 1, 1, 3), (1,1,1,2) HASH(ca) (0,2,2,2), (1,2,2,1) HASH(ar) (0,3,3,1), (1,3,3,0),(2,1,1,2) HASH(re) (0,4,4,0) HASH(rc) (2,2,2,1) HASH(ch) (2,3,3,0) HASH( input[3-7] ) == HASH(scare) Match List (3, 7) National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
Search Min Length 4 Hash Table Index Hash Value HASH(scare) 1 2019/9/3 Min Length 4 Search Hash Table Index Hash Value HASH(scare) 1 HASH(scar) 2 HASH(arch) Input String -2 -1 1 2 3 4 5 6 7 8 a r e s c h ● Match Table Key Values HASH(sc) (0, 1, 1, 3), (1,1,1,2) HASH(ca) (0,2,2,2), (1,2,2,1) HASH(ar) (0,3,3,1), (1,3,3,0),(2,1,1,2) HASH(re) (0,4,4,0) HASH(rc) (2,2,2,1) HASH(ch) (2,3,3,0) HASH( input[3-6] ) == HASH(scar) Match List (3, 7) (3, 6) National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
2019/9/3 EVALUATION Implementation of proposed algorithm is done in C language on Code::Blocks version 12.11. National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
EVALUATION Search Time (ms) Input String Length 2019/9/3 EVALUATION Search Time (ms) Input String Length Number of patterns is kept fixed and length of Input String is varied from 10,000 to 200,000, this algorithm takes searching time of O(n/P) for Input String of length n. National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab
EVALUATION Search Time (ms) Number of Patterns 2019/9/3 EVALUATION Search Time (ms) Number of Patterns Input String length is kept fixed (100,000) and number of patterns are increased from 3 to 21 keeping length of smallest pattern same among all sets. National Cheng Kung University CSIE Computer & Internet Architecture Lab CSIE CIAL Lab