1 / 17

一种基于最小完美散列 多关键词匹配算法

一种基于最小完美散列 多关键词匹配算法. 谭建龙 计算所软件室 2002-7. 内容. 散列函数介绍 计算保序最小完美散列函数 算法概要 预处理介绍 搜索算法介绍 总结和展望. 散列函数介绍(1). 散列函数( Hashing Function). aaaa. bbbb. cccc. dddd. 散列函数介绍(2). 完美散列函数( Perfect Hashing Function). aaaa. bbbb. cccc. dddd. 散列函数介绍(3). 最小完美散列函数( Minimal PHF). aaaa. bbbb.

eshe
Télécharger la présentation

一种基于最小完美散列 多关键词匹配算法

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 一种基于最小完美散列多关键词匹配算法 谭建龙 计算所软件室 2002-7

  2. 内容 • 散列函数介绍 • 计算保序最小完美散列函数 • 算法概要 • 预处理介绍 • 搜索算法介绍 • 总结和展望

  3. 散列函数介绍(1) • 散列函数(Hashing Function) aaaa bbbb cccc dddd

  4. 散列函数介绍(2) • 完美散列函数(Perfect Hashing Function) aaaa bbbb cccc dddd

  5. 散列函数介绍(3) • 最小完美散列函数(Minimal PHF) aaaa bbbb cccc dddd

  6. 散列函数介绍(4) • 保序最小完美散列函数(Order preserving MPHF) aaaa bbbb cccc dddd

  7. 保序最小完美散列函数(MPHF) • 没有任何冲突的把n个关键词散列到0..n-1 • 第i个关键词一定散列为i-1;

  8. MPHF搜索算法 建立随机的表三张随机表 计算出一个图Graph 存在回路 找到了MPHF

  9. 保序最小完美散列函数 • 空间复杂性 • 三张随机表:关键词长度×字符集大小 • 计算的图: 1。23×关键词个数 • 时间复杂性 • O( 关键词个数)

  10. MPHF函数 字符串 关键词长度次查询 3张随机表 3个整数 4次求模运算 3次查询图 1张图 散列值

  11. 实际使用的MPHF函数 第 一 步 散 列 字符串 关键词长度次查询 3张随机表 3个整数 第 二 步 散 列 4次求模运算 3次查询图 1张图 散列值

  12. MPHF-Match算法概要 • 预处理 • 建立一个基于关键词的保序最小完美散列函数(MPHF) • 建立任何一个整数跳跃距离的表 • 建立一个使用hashFirst函数检测的表 • 搜索文本 • 使用整数表跳跃前进 • 使用检测表快速检测 • 使用MPHF函数确认发现关键词

  13. 预处理 • 建立一个基于关键词的保序最小完美散列函数(MPHF) • 建立任何一个整数跳跃距离的表 • 建立一个使用hashFirst函数检测的表

  14. 搜索文本 • 使用整数表跳跃前进 • 使用检测表快速检测 • 使用MPHF函数确认发现关键词

  15. Text Text Text Text Text Text Text Text Text TextTextTextText x xtTe Text 整数散列 整数跳跃表 计算跳跃距离 跳跃

  16. Text Text Text Text Text Text Text Text Text TextTextTextText x xtTe 整数散列 整数跳跃表 计算跳跃距离 Text Text Text Text Te 检测表 3张随机表 第一步MPHF 第二步MPHF 1个图 确认匹配关键词

  17. Table5.1: Runtimes for string searching50 times Patterns Length fgrep agrep Huff-Match 100 7 47.0 36.1 34.0 500 7 43.5 31.0 25.0 1000 7 47.1 36.5 33.0 1500 7 51.8 39.8 35.3 2000 7 55.3 43.1 38.4 1000 10 34.3 26.1 24.0 1500 10 37.4 28.7 25.9 2000 10 40.8 31.8 28.4 算法性能

More Related