1 / 24

Faster 2-Dimensional Scaled Matching

Faster 2-Dimensional Scaled Matching. Amihood Amir and Eran Chencinski. Real Scaling. Given an n x n Text T, m x m pattern P, find all occurrences of P in T, scaled to any read scale Best known algorithm [Amir at el.]: Time: O(nm 3 +n 2 m*log(m)) Space: O(nm 3 +n 2 ) Our Altorithm:

Télécharger la présentation

Faster 2-Dimensional Scaled Matching

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. Faster 2-Dimensional Scaled Matching Amihood Amir and Eran Chencinski

  2. Real Scaling • Given an n x n Text T, m x m pattern P, find all occurrences of P in T, scaled to any read scale • Best known algorithm [Amir at el.]: • Time: O(nm3+n2m*log(m)) Space: O(nm3+n2) • Our Altorithm: • Time: O(n2m) Space: O(n2)

  3. Scaling – Geometric Definition

  4. Scaling – Algebraic Definition • Rounding Function:

  5. Scaling – Algebraic Definition • Given pattern P, of size m x m, and scale r • The first row would be scaled to || 1*r || • The first 2 rows would be scaled to || 2*r || • … • The first m rows would be scaled to || m*r || • Similarly on the columns

  6. Scaling – Algebraic Definition • Rounding Function: • Inverse Rounding Function: suppose we know that K rows where scaled to L row:

  7. Subrow/column Repetition Query Query time: O(1), preprocessing time: O(n2)

  8. Algorithm Layout The algorithm consists of 4 stages: 1. Scale Elimination 2. Candidate Consistency 3. Candidate Verification 4. Occurrence Recognition Each stage takes O(n2m) time and O(n2) space

  9. Scale Elimination Stage Pivot

  10. Scale Elimination Stage (i,j)

  11. (i,j) Scale Elimination Stage O(m) time for each location, O(n2m) total, O(n2) space

  12. Candidate Consistency Stage

  13. Candidate Consistency Stage Case (a) Case (b)

  14. Witness Table Construction For each suffix O(m2) time and O(m) space

  15. Pre-Dueling Step For each candidate c in T: For each suffix s of P: Compare c’s borders with witness table borders of suffix s If borders are not the same – c is eliminated Can be done in O(m) time for each candidate

  16. Performing a Duel

  17. The Dueling Order Each candidate performs at most O(m) succ. duels

  18. Witness Table construction: • O(m3) time, O(m2) space Pre-Dueling Step: • O(n2m) time, O(m2) space # of Duel • At most O(n) unsucc., at most O(n2m) succ. where each duel takes O(1) time Total: O(n2m) time, O(n2) space Candidate Consistency Stage

  19. Candidate Verification Stage

  20. Candidate Verification Stage For each location find maximal containing interval Can be solved in O(n) time per row using solution to Maximal Interval Problem

  21. Candidate Verification Stage Once we find the largest interval we: • Verify each row in O(m) time, using subcolumn repetition queries • Save the longest matching length • For each candidate run a Range Minimum Query on the lengths The pattern appears iff pattern size >= RMQ

  22. Finding largest intervals: • O(n) time per row, O(n2) total Verifing columns: • O(nm) time per row, O(n2m) total RMQ : • Preprocess: O(n) time per row, O(n2) total • Quering: O(1) time per candidate, O(n2) total Total: O(n2m) time, O(n2) space Candidate Verification Stage

  23. Recall: Scale elimination stage returned Occurrence Recognition Stage At most O(m) steps per candiate Total: O(n2m) time

  24. Conclusions The algorithm consists of 4 stages: 1. Scale Elimination 2. Candidate Consistency 3. Candidate Verification 4. Occurrence Recognition Each stage takes O(n2m) time and O(n2) space

More Related