
Tree::Suffix - Perl interface to the libstree library

use Tree::Suffix; $tree = Tree::Suffix->new; $tree = Tree::Suffix->new(@strings); $tree->insert(@strings); $tree->remove(@strings); @lcs = $tree->lcs; @lcs = $tree->lcs($min_len, $max_len); @lcs = $tree->longest_common_substrings; @lrs = $tree->lrs; @lrs = $tree->lrs($min_len, $max_len); @lrs = $tree->longest_repeated_substrings; $num = $tree->strings; $num = $tree->nodes; $tree->clear; $tree->dump;

The Tree::Suffix module provides an interface to the C library libstree, which implements generic suffix trees.

Creates a new Tree::Suffix object. The constructor will also accept a list of strings to be inserted into the tree.
Inserts the list of strings into the tree. Returns the number of successfully added strings.
Remove the list of strings from the tree.
Returns a list of the longest common substrings. The minimum and maximum length of the considered substrings may also be specified.
Returns a list of the longest repeated substrings. The minimum and maximum length of the considered substrings may also be specified.
Returns the total number of strings in the tree.
Returns the total number of nodes in the tree.
Removes all strings from the tree.
Prints a representation of the tree to STDOUT.

To find the longest palindrome of a string:
use Tree::Suffix; $str = 'mississippi'; $tree = Tree::Suffix->new($str, scalar reverse $str); ($pal) = $tree->lcs; print "Longest palindrome: $pal\n";
This would print:
Longest palindrome: ississi

libstree http://www.cl.cam.ac.uk/~cpk25/libstree/
http://en.wikipedia.org/wiki/Suffix_tree

Please report any bugs or feature requests to bug-tree-suffix at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Tree-Suffix. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc Tree::Suffix
You can also look for information at:

Copyright (C) 2006 gray <gray at cpan.org>, all rights reserved.
Copyright (C) 2003 Christian Kreibich <christian@whoop.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

gray, <gray at cpan.org>