...

Package algorithm

import "github.com/ob-algdatii-ss19/leistungsnachweis-statischetextsuche/algorithm"
Overview
Index

Overview ▾

Suffix Tree implementation

type AlgImpl

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 (*AlgImpl) BuildTree

func (a *AlgImpl) BuildTree() Tree

BuildTree creates the suffix tree by calling addNode(...) for each substring of the text

func (*AlgImpl) DrawTree

func (a *AlgImpl) DrawTree() (output string)

DrawTree returns the tree formatted as a string

func (*AlgImpl) FindSuffix

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 (*AlgImpl) InitializeAlgorithm

func (a *AlgImpl) InitializeAlgorithm(text string)

InitializeAlgorithm sets all needed values in AlgImpl struct

type Algorithm

Algorithm interface contains methods to create a suffix tree

type Algorithm interface {
    InitializeAlgorithm(text string)
    BuildTree() Tree
    DrawTree() (output string)
}

type Tree

Tree struct contains the root of a suffix tree

type Tree struct {
    // contains filtered or unexported fields
}

func CreateTree

func CreateTree() (tree *Tree)

CreateTree creates a new suffix tree with an empty root node

type TreeNode

TreeNode contains all needed values for suffix tree functionality

type TreeNode struct {
    // contains filtered or unexported fields
}