Skip to content

About

greedy approximation of the shortest common superstring

Resources

Stars

6 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

superstring - greedy approximation of the shortest common superstring

Finding the shortest string containing each member of the input string
set as a substring is a problem with applications in data compression,
computer security and bioinformatics. As the problem is NP-complete
(it can be reformulated as ordering the input strings to maximize
their overlap), it is usually solved approximately. This package
implements a simple approximation algorithm described in

Jonathan S. Turner
Approximation algorithms for the shortest common superstring problem
Information and Computation 83, 1-20, 1989

The suffix tree follows section 3 of the paper: a compacted trie of
all suffixes, with lists of the strings whose suffixes end at each
node, lazy deletion and per-string pointers to the node where the
last lookup ended. It is built by Ukkonen's online algorithm (which
produces the same tree as McCreight's) and keeps the children of each
node in a balanced search tree, so the running time is O(m log n)
plus a factor logarithmic in the alphabet size for the suffix tree
operations. The code does have some other shortcuts (e.g. the heap
isn't a Fibonacci heap), but it should be enough to play with.

When run without arguments, superstring expects the input set on its
standard input, one string per line (IOW the strings cannot contain a
newline; apart from that, they are manipulated as sequences of bytes,
without any encoding) and prints the resulting superstring (terminated
by a newline) on its standard output. It also prints some debug
messages to standard error. superstring can also be run with a -t
parameter, in which case it runs the algorithm on a few hardcoded test
cases and checks the results.


About

greedy approximation of the shortest common superstring

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages