main page  —  COMP 526 Efficient Algorithms

Unit 6: Text Indexing – Searching whole genomes

This is an archived version of this module from Spring 2022.
Click here for the current iteration.

This unit covers data structures over static text that enable very efficient searching in the indexed text, including some more recent advances in this field. We cover

  • inverted indices
  • suffix trees
  • applications of suffix trees: string matching, longest repeated substrings, longest common substrings, k-mismatch matching
  • suffix arrays, LCP array
  • linear-time construction for suffix and LCP arrays

Learning outcomes

  1. Know and understand methods for text indexing: inverted indices, suffix trees, (enhanced) suffix arrays
  2. Know and understand generalized suffix trees
  3. Know properties, in particular performance characteristics, and limitations of the above data structures.
  4. Design (simple) algorithms based on suffix trees.
  5. Understand construction algorithms for suffix arrays and LCP arrays.

Material

  • slides
  • lecture notes

  • Video 6-1 · transcript (2022-03-07, 15:27): §6.1 Motivation, inverted indices
    Chapters2:19 Motivation
    4:27 Text Indexing
    7:57 Inverted Indexing
    12:59 Try
  • Video 6-2 · transcript (2022-03-10, 27:54): §6.1 Tries
  • Video 6-3 · transcript (2022-03-10, 16:58): §6.2 Suffix trees
    Chapters0:20 Suffix trees- A 'magic' data structure
    4:28 Suffix trees - Definition
    11:41 Suffix trees - Construction
    15:14 Clicker Question
  • Video 6-4 · transcript (2022-03-10, 33:37): §6.3 Applications of suffix trees
    Chapters0:13 Applications of suffix trees
    8:35 Text Indexing / String Matching
    17:57 Longest repeated substring
    24:40 Generalized suffix trees
    27:55 Clicker Question
    31:26 Longest common substring - Example
  • Video 6-5 · transcript (2022-03-14, 32:53): §6.4 Longest common extensions
    Chapters0:16 Longest Common Extensions
    6:14 Efficient LCA
    18:11 Clicker Question
    18:16 Application 5: Approximate matching
    20:00 Kangaroo Algorithm for approximate matching
    29:31 Application 6: Matching with wildcards
    30:15 Suffix trees - Discussion
  • Video 6-6 · transcript (2022-03-14, 30:01): §6.5 Suffix arrays
    Chapters0:30 Suffix trees
    1:42 Binary search
    17:00 Suffix tree
    18:47 String sorting
    20:22 Quicksort
  • Video 6-7 · transcript (2022-03-17, 32:08): §6.6 Linear-time suffix sorting – Overview
    Chapters2:07 Inverse suffix arrays
    9:23 Skew algorithm
    17:43 Sort method
    20:40 Example
  • Video 6-8 · transcript (2022-03-17, 11:59): §6.7 Linear-time suffix sorting – DC3 recursion
    Chapters0:15 DC3/ Skew algorithm - Fix recursive call
    4:00 DC3/ Skew algorithm - Fix alphabet explosion
    5:29 DC3 / Skew algorithm - Fix recursive call
    6:34 DC3 / Skew algorithm - Fix alphabet explosion
    6:49 DC3/ Skew algorithm - Step 3. Example
    9:18 Suffix array - Discussion
  • Video 6-9 · transcript (2022-03-17, 11:29): §6.8 LCP arrays
    Chapters1:40 String Depth
    4:45 LCP array
  • Video 6-10 · transcript (2022-03-17, 18:12): §6.9 LCP array construction & back to suffix trees
    Chapters3:36 Kasai's algorithm explained
    11:01 Implementation details
    11:58 Complexity analysis
    14:25 Enhanced suffix arrays
    17:01 Applications and compression

Further reading and sources

There is no textbook that covers all topics, but parts can be found in the following sources, all of which cover much more than the topics I selected.

Tries: These are notoriously treated only in passing in most algorithms and data structures textbooks, and there are various little differences in the details. Apart from the fact that they do not insist on prefix-free keys, I find the most helpful treatment of tries is given by Sedgewick and Wayne:

Suffix trees:

Suffix arrays have not yet found widespread inclusion in standard textbooks; my way of presenting it is mostly my own, but took inspiration from

Suffix arrays and LCP arrays are also discussed (in slightly different form) in


Unit 5  ⋅  Syllabus  ⋅  Unit 7