int (*LST_NodeVisitCB) (LST_Node *node, void *data); void lst_alg_bfs (LST_STree *tree, LST_NodeVisitCB callback, void *data); void lst_alg_dfs (LST_STree *tree, LST_NodeVisitCB callback, void *data); void lst_alg_bus (LST_STree *tree, LST_NodeVisitCB callback, void *data); void lst_alg_leafs (LST_STree *tree, LST_NodeVisitCB callback, void *data); u_int lst_alg_set_visitors (LST_STree *tree); LST_StringSet* lst_alg_longest_common_substring (LST_STree *tree, u_int min_len, u_int max_len); LST_StringSet* lst_alg_longest_repeated_substring (LST_STree *tree, u_int min_len, u_int max_len); |
int (*LST_NodeVisitCB) (LST_Node *node, void *data); |
This is the signature of the callbacks used in several of the algorithms below, that iterate over the tree. They call a callback of this signature for every node they visit.
node currently visited.
arbitrary data passed through.
value > 0 if the iteration algorithm that called this node is to proceed beyond this node, or 0 if not. Note that this does not necessarily mean that an algorithm will abort when the return value is 0.
void lst_alg_bfs (LST_STree *tree, LST_NodeVisitCB callback, void *data); |
The algorithm iterates the tree in breadth-first order, calling callback for each node visited.
suffix tree to iterate.
callback to call for each node.
user data passed through to callback.
void lst_alg_dfs (LST_STree *tree, LST_NodeVisitCB callback, void *data); |
The algorithm iterates the tree in depth-first order, calling callback for each node visited.
suffix tree to iterate.
callback to call for each node.
user data passed through to callback.
void lst_alg_bus (LST_STree *tree, LST_NodeVisitCB callback, void *data); |
The algorithm iterates the tree in bottom-up order, calling callback for each node visited. This algorithm ignores the return value of callback.
suffix tree to iterate.
callback to call for each node.
user data passed through to callback.
void lst_alg_leafs (LST_STree *tree, LST_NodeVisitCB callback, void *data); |
The algorithm iterates over all leafs in the tree, calling callback for each node visited. If callback returns 0, it stops.
suffix tree to visit.
callback to call for each node.
user data passed through to callback.
u_int lst_alg_set_visitors (LST_STree *tree); |
The algorithm updates the visitor elements in each node of tree to contain a one-bit for each string index that is contained in the tree.
tree to update.
bitstring representing a node visited by all strings.
LST_StringSet* lst_alg_longest_common_substring (LST_STree *tree, u_int min_len, u_int max_len); |
The algorithm computes the longest common substring(s) in tree and returns them as a new string set. This is currently a suboptimal O(n^2) implementation until I have time for the more sophisticated O(n) implementation available. If you want to limit the string length, pass an appropriate value for max_len, or pass 0 if you want the longest string(s) possible. Similarly, if you want to receive only longest common substrings of at least a certain number of items, use min_len for that, or pass 0 to indicate interest in everything.
tree to use in computation.
minimum length that common substrings must have to be returned.
don't return strings longer than max_len items.
new string set, or NULL when no strings were found.
LST_StringSet* lst_alg_longest_repeated_substring (LST_STree *tree, u_int min_len, u_int max_len); |
The algorithm computes the longest repeated substring(s) in tree and returns them as a new string set. This is currently a suboptimal O(n^2) implementation until I have time for the more sophisticated O(n) implementation available. If you want to limit the string length, pass an appropriate value for max_len, or pass 0 if you want the longest string(s) possible. Similarly, if you want to receive only longest repeated substrings of at least a certain number of items, use min_len for that, or pass 0 to indicate interest in everything.
tree to use in computation.
minimum length that repeated substrings must have to be returned.
don't return strings longer than max_len items.
new string set, or NULL when no strings were found.