AlgImpl struct contains needed values for the algorithm text: text on which the suffix tree is based length: length of the text tree: pointer on the suffix tree
type AlgImpl struct {
// contains filtered or unexported fields
}
func (a *AlgImpl) BuildTree() Tree
BuildTree creates the suffix tree by calling addNode(...) for each substring of the text
func (a *AlgImpl) DrawTree() (output string)
DrawTree returns the tree formatted as a string
func (a *AlgImpl) FindSuffix(suffix string) (indices []int)
FindSuffix searches in tree for a node representing the inserted search string and return its start indices suffix: inserted search string
func (a *AlgImpl) InitializeAlgorithm(text string)
InitializeAlgorithm sets all needed values in AlgImpl struct
Algorithm interface contains methods to create a suffix tree
type Algorithm interface { InitializeAlgorithm(text string) BuildTree() Tree DrawTree() (output string) }
Tree struct contains the root of a suffix tree
type Tree struct {
// contains filtered or unexported fields
}
func CreateTree() (tree *Tree)
CreateTree creates a new suffix tree with an empty root node
TreeNode contains all needed values for suffix tree functionality
type TreeNode struct {
// contains filtered or unexported fields
}