Shape-Preserving Pattern Matching Algorithms

shape preserving pattern matching n.w
1 / 13
Embed
Share

This paper discusses shape-preserving pattern matching algorithms that identify sequences shape-isomorphic to a given pattern. Two linear-time algorithms are presented, offering solutions through reduction and online techniques. Various images provide visual representations and examples of the process.

  • Pattern Matching
  • Algorithms
  • Shape-Preserving
  • Computer Science
  • Sequence Matching

Uploaded on | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Shape-Preserving Pattern Matching Domenico Cantone, Simone Faro and M.Oguzhan K lekci, 21st Italian Conference on Theoretical Computer Science, 14-16 September 2020, Ischia, Italy Presenter: Wen-Wen Liao Date: May. 2, 20231

  2. Abstract Two sequences of integers x and z of the same length m 2 are shape- isomorphic if, up to a positive proportional factor, the sequences of the distances between consecutive elements of x and z are the same, i.e., if for some > 0 one has x[i + 1] x[i] = (z[i + 1] z[i]), for each 1 i m 1. In this paper we present two linear-time algorithms which, given a text y and a pattern x over an integer alphabet, finds all the factors of y that are shape-isomorphic to x. Our first solution is a two steps algorithm based on a reduction to the standard exact string matching problem, while our second solution is an online algorithm based on the well-known Knuth-Morris-Pratt string matching algorithm. We call this problem shape-preserving pattern-matching problem. 2

  3. Shape-Preserving Pattern Matching Finer than order-isomorphism. Proportionality factors is 3 and 2, respectively. 6 6 9 4 4 6 2 2 3 3

  4. Reducing SPPM to Exact Pattern Matching y = 14 18 15 18 12 21 15 25 26 x = 6 8 4 10 6 find k to separate ?1and ?2, ? = max( ?: ? > 0 ??? ? ? ? ? + 1 k = 4 ?1= 6 8 4 10 => prefix ?2= 10 6 => suffix 0 ) 4

  5. Reducing SPPM to Exact Pattern Matching Delta function: for 1 ? ? 1, ? ? ? ? + 1 ? ? Last Non-Zero Function: for 1 ? ? 1,? ? ? ? ? ? ??? ? = max({1 < ? + 1:?[ ] 0} {0}) ?[?+1] ? ? [?] Ratios Function: for 1 ? ? 1, ? ? 5

  6. Reducing SPPM to Exact Pattern Matching y = 14 18 15 18 12 21 15 25 26 x = 6 8 4 10 6 ?1= 6 8 4 10 ?2= 10 6 i 1 2 2 -2 2 -4 2 3 3 6 6 i 1 6 6 2 -4 6 (?1) [i] ( (?1) )[i] ( (?1) )[i] (?2) [i] ( (?2))[i] ( (?2) )[i] 2 3 6

  7. Reducing SPPM to Exact Pattern Matching y = 14 18 15 18 12 21 15 25 26 x = 6 8 4 10 6 1= occurrences of (?1) in (?) 2= occurrences of ((?2)) in (?) i 1 2 3 i 1 2 (?1) [i] ( (?1) )[i] ( (?1) )[i] 2 -4 6 (?2) [i] ( (?2))[i] ( (?2) )[i] 6 -4 2 2 6 6 6 2 -2 3 3 i 1 4 4 2 -3 4 3 4 3 3 4 4 -6 4 9 4 5 9 9 6 -6 9 10 9 7 8 1 (y) [i] ( (y) )[i] ( (y) )[i] 10 10 1 10 10 3 6 6 9 4 4 7

  8. Reducing SPPM to Exact Pattern Matching y = 14 18 15 18 12 21 15 25 26 x = 6 8 4 10 6 = {? ? + 2:? 2??? ? ? + 2 1??? ? ? 1 ? ? ? => i = 3 > 0} i 1 4 4 2 -3 4 3 4 3 3 4 4 -6 4 9 4 5 9 9 6 -6 9 10 9 7 8 1 (y) [i] ( (y) )[i] ( (y) )[i] 10 10 1 10 10 3 6 6 9 4 4 8

  9. A KMP based Algorithm for the SPPM Problem x = 4 2 10 6 22 14 13 17 shape-border table i 1 4 0 - 2 2 1 0 3 4 6 2 2 5 6 7 8 -2 -4 x[i] [i] [i] 10 1 22 3 2 14 4 2 13 2 0.5 17 3 0.5 0 9

  10. A KMP based Algorithm for the SPPM Problem x = 4 2 10 6 22 14 13 17 shape-border table i 1 4 0 - 2 2 1 0 3 4 6 2 2 5 6 7 8 8 16 x[i] [i] [i] 10 1 22 3 2 14 4 2 13 2 0.5 17 3 0.5 0 10

  11. A KMP based Algorithm for the SPPM Problem y = 14 18 15 18 12 21 15 25 26 x = 6 8 4 10 6 i 1 6 0 - 2 8 1 0 3 4 1 4 5 6 3 1 x[i] [i] [i] 10 2 3 0 11

  12. A KMP based Algorithm for the SPPM Problem i 1 6 0 - 2 8 1 0 3 4 1 4 5 6 3 1 y = 14 18 15 18 12 21 15 25 26 x = 6 8 4 10 6 x[i] [i] [i] 10 2 3 0 14 18 15 18 12 21 15 25 26 6 8 4 10 6 1 2 [2] = 1 1 2-1=1 6 8 4 10 6 0 1 1 [1] = 0 0 1-0=1 6 8 4 10 6 1 12

  13. Conclusion Reducing SPPM to Exact Pattern Matching Time complexity: ?(? + ?) A KMP based Algorithm for the SPPM Problem Time complexity: ?(?) 13

Related


More Related Content