alg

package
v0.0.0-...-36d9f8f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2019 License: Apache-2.0 Imports: 1 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Height

func Height(rootNode Node) int

func Traverse

func Traverse(rootNode Node, visit VisitFn)

Types

type Coordinate

type Coordinate struct {
	*coordinate.Coordinate
}

func NewCoordinate

func NewCoordinate(x, y int) *Coordinate

func (*Coordinate) Equal

func (c *Coordinate) Equal(other *Coordinate) bool

func (*Coordinate) ID

func (c *Coordinate) ID() string

func (*Coordinate) Neighbors

func (c *Coordinate) Neighbors() []Node

type Node

type Node interface {
	ID() string
	Neighbors() []Node
}

func Find

func Find(rootNode Node, id string) (path []Node)

func TraverseLevel

func TraverseLevel(rootNode Node, level int) []Node

type NodeQueue

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

func (*NodeQueue) Len

func (n *NodeQueue) Len() int

func (*NodeQueue) Nodes

func (n *NodeQueue) Nodes() []Node

func (*NodeQueue) Peek

func (n *NodeQueue) Peek() (node *PathNode)

func (*NodeQueue) Push

func (n *NodeQueue) Push(nodes ...*PathNode)

func (*NodeQueue) Shift

func (n *NodeQueue) Shift() (node *PathNode)

type PathNode

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

func (*PathNode) Node

func (p *PathNode) Node() Node

func (*PathNode) String

func (p *PathNode) String() string

type VisitFn

type VisitFn func(int, []Node) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL