diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2012-11-05 15:29:46 +0100 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2012-11-05 15:29:46 +0100 |
commit | 6f29f345dc06c1a1033475eac1d1340781d1d603 (patch) | |
tree | 6fa4cdd7aefd7d54c9585c2c6274db61bb8b159a /extools/suffix_tree.h | |
parent | b510da2e562c695c90d565eb295c749569c59be8 (diff) | |
parent | c615c37501fa8576584a510a9d2bfe2fdd5bace7 (diff) |
merge upstream/master
Diffstat (limited to 'extools/suffix_tree.h')
-rw-r--r-- | extools/suffix_tree.h | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/extools/suffix_tree.h b/extools/suffix_tree.h deleted file mode 100644 index f62f53f4..00000000 --- a/extools/suffix_tree.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * suffix_tree.h - * - * Created on: May 17, 2010 - * Author: Vlad - -NOTE (graehl): this seems to be a (forward) trie of the suffixes (of sentences). -so O(m*n^2) for m sentences of length n. - -For a real suffix tree (linear size/time), see: -http://en.wikipedia.org/wiki/Suffix_tree -http://www.cs.helsinki.fi/u/ukkonen/SuffixT1withFigs.pdf - - */ - -#ifndef SUFFIX_TREE_H_ -#define SUFFIX_TREE_H_ - -#include <string> -#include <map> -#include <vector> - -template <class T> -class Node { - public: - std::map<T, Node> edge_list_; - int InsertPath(const std::vector<T>& p, int start, int end); - const Node* Extend(const T& e) const { - typename std::map<T, Node>::const_iterator it = edge_list_.find(e); - if (it == edge_list_.end()) return NULL; - return &it->second; - } -}; - -bool DEBUG = false; - -template <class T> -int Node<T>::InsertPath(const std::vector<T>& p, int start, int end){ - Node* currNode = this; - for(int i=start;i<= end; i++ ) { - currNode = &(currNode->edge_list_)[p[i]]; - } - return 1; -} - -#endif /* SUFFIX_TRIE_H_ */ |