Skip to main content
. 2018 Dec 21;19(1):29. doi: 10.3390/s19010029
Algorithm 1 The core code of PrefixSpan+
Input: Sequence dataset S, Threshold of support degree min_sup
Output: The set of frequent sequential pattern FS
1: Scan S, count the support number of all the items with length = 1, and delete the items from S, of which the support degree is less than min_sup, then obtain S’. The set of length-1 sequential pattern P contains all the items that are satisfied with the required support degree.
2: FS = P
3: Extension(S’, P)
4: For each PjP, construct CMAP for Pj from S’
5:   if CMAPi=CMAPs=ϕ
6:     return FS
7:   else
8:     if CMAPiϕ, traverse CMAPi
9:      extend all the items in cmi(j) to Pj by i-extension, and obtain Pji
10:     if CMAPsϕ, traverse CMAPs
11:      extend all the items in cms(j) to Pj by s-extension, and obtain Pjs
12:     Pj=PjiPjs // Property 3
13:     P=jPj, FS=FSP
14:     Extension(S’, P’)