http://www.paper.edu.cn
- 1 -
中国科技论文在线
分布式环境下的模式匹配算法
刘杰,杨文川
**
作者简介:刘杰,1987 年 3 月出生,男,硕士研究生,研究方向数据挖掘
通信联系人:杨文川,1970 年出生,男,副教授,研究方向数据挖掘. E-mail: wenchuanyang@yahoo.com
(北京邮电大学信息与通信工程学院,北京 100876)
摘要:模式匹配算法是信息处理中常用的算法。但大部分经典的模式匹配算法提出的时间都5
比较早,即使这些算法效率很高,在处理海量数据时也有些乏力。如今分布式计算技术已成
为处理海量数据的基本方法。本文利用分布式计算法的技术,对经典的 WM 模式匹配算法
进行改进,提出了一种分布式环境下的模式匹配算法。该算法充分利用 Map-Reduce 的特性,
将 WM 的预处理过程和匹配过程拆分成 Map-Reduce 作业,使处理过程并发进行。本文还将
此算法的执行结果与经典的串行的模式匹配算法进行时间效率上的对比,从而证明该算法在10
效率上的优势。
关键词:模式匹配;分布式计算;Map-Reduce;并行
中图分类号:TP391
The Pattern Matching Algorithm In Distributed Computing 15
Environment
LIU Jie, YANG Wenchuan
(School of Information and Communication Engineering,Beijing University of Posts and
Telecommunications, Beijing 100876)
Abstract: Pattern Matching is a very popular method in information pocessing. However, most pattern 20
matching algorithm are proposed many years ago. Even though these algorithms are very effective,
they are not proper for processing huge amount of data. These years, distributed computing becomes a
basic approach to handle this. This paper will use this technology to improve the classic WM pattern
matching algorithm and propose a pattern matching algorithm in distributed computing environment.
This algoritm will take Map-Reduce features, spliting the processing into pieces of Map-Reduce jobs
25
and making them work simultaneously. This paper will also compare the efficiency of this algorithm
with that of the basic pattern matching algorithm, proving this algorithm is more effective.
Key words: pattern matching; distributed computing; Map-Reduce; parallel processing
0 引言 30
模式匹配的算法很多,比较经典的有 KMP 算法
[1]
、KR 算法
[2]
、BM 算法
[3]
以及 WM 算
法
[4]
等,这些算法大都年代比较久远,在此之后也有很多人提出过针对这些算法的改进。甚
至在某些特定的场合通过一定的条件约束或者特定数据结构可以设计出特定的高效算法,但
是数据量的增长已经远远超过这些算法改进能处理的程度。近年来云计算技术的发展,使得
处理海量数据有了更一般的解决方案。本文利用这些比较典型但是更适合一般情况的算法,35
结合云计算环境的相关技术,通过多台机器的协作并行来完成大数据量的模式匹配。
1 经典模式匹配算法
为了更好的讲述模式匹配算法,我们先做如下的定义:
假设字符集为∑,P[1:m]为匹配模式,其中 m 为匹配模式 P 的长度,T[1:n]为被匹配的
串,其中 n 为 T 的长度,且 P 和 T 都是字符集∑任意字符。一般情况下,假设 n>m。所有40
评论0
最新资源