Generalized suffix array

In computer science, a generalized suffix array (GSA) is a suffix array containing all suffixes for a set of strings. Given the set of strings S=S1,S2,S3,...,Sk of total length n, it is a lexicographically sorted array of all suffixes of each string in S. It is primarily used in bioinformatics and string processing.

## Contents

* 1 Functionality
* 2 Construction Algorithms and Implementations
* 3 Solving the Pattern Matching Problem
* 4 Other Applications
* 5 See also
* 6 References
* 7 External links

## Functionality

The functionality of a generalized suffix array is as follows:[1]

* For a collection or set of strings, S=S1,S2,S3,...,Sk.
* It is a lexicographically sorted array of all suffixes of each string in the set S.
* In the array, each suffix is represented by an integer pair (i,j) which denotes the suffix starting from position j in si.
* In the case where different strings in S have identical suffixes, in the generalized suffix array, those suffixes will occupy consecutive positions. However, for convenience, the exception can be made where repeats will not be listed.

A generalized suffix array can be generated for a generalized suffix tree. When compared to a generalized suffix tree, while the generalized suffix array will require more time to construct, it will use less space than the tree.

## Construction Algorithms and Implementations

Algorithms and tools for constructing a generalized suffix array include:

* Fei Shi's (1996) algorithm which runs in 𝒪(Nlog⁡n) worst case time and 𝒪(N) space, where N is the sum of the lengths of all strings in S and n the length of the longest string in S. This includes sorting, searching and finding the longest common prefixes.[1]
* The external generalized enhanced suffix array, or eGSA, construction algorithm which specializes in external memory construction, is particularly useful when the size of the input collection or data structure is larger than the amount of available internal memory[2]
* gsufsort is an open-source, fast, portable and lightweight tool for the construction of generalized suffix arrays and related data structures like Burrows–Wheeler transform or LCP Array)[3]
* Mnemonist, a collection of data structures implemented in JavaScript contains an implementation for a generalized suffix tree and can be found publicly on npm and GitHub.[4]

## Solving the Pattern Matching Problem

Generalized suffix arrays can be used to solve the pattern matching problem:[5]

* Given a pattern P and a text T, find all occurrences of P in T.
* Using the generalized suffix array G of T, then first, the suffixes that have P as a prefix need to be found.
* Since G is a lexicographically sorted array of the suffixes of T, then all such suffixes will appear in consecutive positions within G. Particularly important, since G is sorted, it makes identification of suffixes possible and easy using binary search.
* Using binary search, first find the smallest index i in G such that suffG[i] contains P as a prefix, or determine that no such suffix is present. In the case where the suffix is not found, P does not occur in T. Otherwise, find the largest index j(≥i) which contains P as a prefix. The elements in the range G[i..j] indicate the starting positions of the occurrences of P in T.
* Binary search on G takes Θ(logn) comparisons. P is compared with a suffix to determine their lexicographic order in each comparison that is done. Thus, this requires comparing at most |P|=m characters. Note that a lcp array is not required, but will offer the benefit of a lower running time.

The runtime of the algorithm is Θ(mlogn). By comparison, solving this problem using suffix trees takes Θ(m) time. Note that with a generalized suffix array, the space required is smaller compared to a suffix tree, since the algorithm only requires space for n words and the space to store the string. As mentioned above, by optionally keeping track of lcp information which will use slightly more space, the running time of the algorithm can be improved to Θ(m+logn).

## Other Applications

* A generalized suffix array can be utilized to compute the longest common subsequence of all the strings in a set or collection. A naive implementation would compute the largest common subsequence of all the strings in the set in Θ(n2).[6]
* A generalized suffix array can be utilized to find the longest previous factor array, a concept central to text compression techniques and in the detection of motifs and repeats[7]

## See also

* Suffix Tree
* Suffix Array
* Generalized Suffix Tree
* Pattern matching problem
* Bioinformatics

## References

1. ↑ 1.0 1.1 Shi, Fei (1996), Suffix arrays for multiple strings: A method for on-line multiple string searches., Lecture Notes in Computer Science, 1179, Springer Berlin Heidelberg, pp. 11–22, doi:10.1007/BFb0027775, ISBN 978-3-540-62031-0
2. ↑ Louza, Felipe; Telles, Guilherme; Hoffman, Steve; Ciferri, Cristina (2017), "Generalized enhanced suffix array construction in external memory", Algorithms for molecular biology : AM 12: p. 26, doi:10.1186/s13015-017-0117-9, PMID 29234460
3. ↑ Louza, Felipe, gsufsort, https://github.com/felipelouza/gsufsort
4. ↑ Plique, Guillaume, Mnemonist: Curated collection of data structures for the JavaScript language.
5. ↑ Aluru, Srinivas, Suffix Trees and Suffix Arrays, http://web.cs.iastate.edu/~cs548/suffix.pdf
6. ↑ Plique, Guillaume, Mnemonist: Generalized Suffix Array
7. ↑ Crochemore, Maxime; Grossi, Roberto; Kärkkäinen, Juha; Landau, Gad (2013), "A Constant-Space Comparison-Based Algorithm for Computing the Burrows–Wheeler Transform", Combinatorial Pattern Matching. CPM 2013. Lecture Notes in Computer Science, Lecture Notes in Computer Science (Springer, Berlin, Heidelberg) 7922: pp. 74–82, doi:10.1007/978-3-642-38905-4_9, ISBN 978-3-642-38904-7

## External links

Generalized enhanced suffix array construction in external memory

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Generalized suffix array. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Generalized_suffix_array&oldid=329602"