Documentation
¶
Index ¶
- type Edge
- type Node
- func (node *Node) BFS(callback WalkCallback)
- func (node *Node) Children() []*Node
- func (node *Node) Condense() error
- func (node *Node) Count() int
- func (node *Node) DFS(callback WalkCallback)
- func (node *Node) GetEdge(item interface{}) *Edge
- func (node *Node) GetEdges() []*Edge
- func (node *Node) Insert(prefix interface{}) error
- type WalkCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct {
PrefixCount int
Prefix interface{}
}
Edge is the connection between two nodes
type Node ¶
Node implementing NodeInterface
func (*Node) BFS ¶
func (node *Node) BFS(callback WalkCallback)
BFS performs breadth first search on the trie and calls callback with each node element
func (*Node) Condense ¶
Condense marks the trie as un-mutable and in case parent has single child, it merges itself with parent node. Prefix interface must support Addition operation, otherwise it will cause panic.
func (*Node) Count ¶
Count returns sum of items passing through this node i.e. prefix and data counts
func (*Node) DFS ¶
func (node *Node) DFS(callback WalkCallback)
DFS performs breadth first search on the trie and calls callback with each node element and prefix till now
type WalkCallback ¶
type WalkCallback func(interface{}, int)
WalkCallback is a callback for the bfs/dfs functions
Click to show internal directories.
Click to hide internal directories.