Skip to main content
. 2015 Mar 5;15(3):5344–5375. doi: 10.3390/s150305344
Function. PCP_Filtering(STP)
Method:
  1. While palindrome-contained pattern is found, do{

  2. (µ, λ)←Find_PCP(trans(STP))

  3. If palindrome-contained pattern is found, do {

  4. For STP, combine fragments <(sµ, tµ, Tµ),…, (sµ+λ-1, tµ+λ-1, Tµ+λ-1)>, <(sµ+λ, tµ+λ, Tµ+λ),…, (sµ+2λ-1, tµ+2λ-1, Tµ+2λ-1)> and <(sµ+2λ, tµ+2λ, Tµ+2λ),…, (sµ+3λ-1, tµ+3λ-1, Tµ+3λ-1)> to form a new STP according to Definition 13.} }

  5. Return STP

Sub-Function. Find_PCP(SP)
  1. Initialize V, LC and LCS as empty

  2. Suppose SP = <s0, s1, …, sn>. For each path segment si in SP, do {

  3. If V is not empty, do {

  4. Get the position of the last element of V (say cur_pos_seg), and compare the last element of V with si. If they are reverse-order, let variable reverse-order be true. Otherwise, let variable reverse-order be false. }

  5. Else let reverse-order be false.

  6. Push si onto V.

  7. For each candidate triple (b_pos, e_pos, cur_pos) in LC, do {

  8. If cur_pos is “null”, let cur_pos be b_pos; otherwise, let cur_pos be added by 1.

  9. Compare V[cur_pos] with si. If they are same, do {

  10. Let this triple be (b_pos, e_pos, cur_pos) and update it in LC. If cur_pos equals to e_pos, then a palindrome-contained pattern is found. Let µbe b_pos, λbe e_pos-b_pos+1, return the pair of µand λ, and exit this sub-function. }

  11. Else delete this candidate triple from LC. }

  12. For each pair (inter_posi, e_posi) in LCS, do {

  13. If inter_posi-1 0, and V[inter_posi-1] and si are reverse-order, set this pair as (inter_posi-1, e_posi) in LCS, and generate a new candidate (inter_posi-1, e_posi, “null”) in LC. Otherwise, delete this pair from LCS. }

  14. If reverse-order is true, do {

  15. Produce a candidate (cur_pos_seg, cur_pos_seg, “null”) and insert it to LC.

  16. Generate a candidate suffix (cur_pos_seg, cur_pos_seg) and add it to LCS. } }

  17. No palindrome-contained pattern is found. Return the pair of “null” and “null”.