[−][src]Struct generalized_suffix_tree::GeneralizedSuffixTree
This is the generalized suffix tree, implemented using Ukkonen's Algorithm. One important modification to the algorithm is that this is no longer an online algorithm, i.e. it only accepts strings fully provided to the suffix tree, instead of being able to stream processing each string. It is not a fundamental limitation and can be supported.
Examples
use generalized_suffix_tree::GeneralizedSuffixTree; let mut tree = GeneralizedSuffixTree::new(); tree.add_string(String::from("ABCDABCE"), '$'); tree.add_string(String::from("CDEFDEFG"), '#'); println!("{}", tree.is_suffix("BCE"));
Methods
impl GeneralizedSuffixTree
[src]
pub fn new() -> GeneralizedSuffixTree
[src]
pub fn add_string(&mut self, s: String, term: char)
[src]
Add a new string to the generalized suffix tree.
pub fn longest_common_substring_all(&self) -> String
[src]
Find the longest common substring among all strings in the suffix.
This function can be used when you already have a suffix tree built,
and would need to know the longest commmon substring.
It can be trivially extended to support longest common substring among
K
strings.
pub fn longest_common_substring_with<'a>(&self, s: &'a String) -> &'a str
[src]
Find the longest common substring between string s
and the current suffix.
This function allows us compute this without adding s
to the suffix.
pub fn is_suffix(&self, s: &str) -> bool
[src]
Checks whether a given string s
is a suffix in the suffix tree.
pub fn is_substr(&self, s: &str) -> bool
[src]
Checks whether a given string s
is a substring of any of the strings
in the suffix tree.
pub fn pretty_print(&self)
[src]
Trait Implementations
Auto Trait Implementations
impl Send for GeneralizedSuffixTree
impl Unpin for GeneralizedSuffixTree
impl Sync for GeneralizedSuffixTree
impl UnwindSafe for GeneralizedSuffixTree
impl RefUnwindSafe for GeneralizedSuffixTree
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,