dijkstra

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("no path found")
)

Functions

This section is empty.

Types

type CostFunction

type CostFunction func(from, to Point) int64

type PathFinder

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

func NewPathFinder

func NewPathFinder(start, end Point) *PathFinder

func (*PathFinder) AddConnection

func (pf *PathFinder) AddConnection(from Point, cost CostFunction, to ...Point)

func (*PathFinder) BestPath

func (pf *PathFinder) BestPath() ([]Point, error)

type Point

type Point interface {
	String() string
	Coordinates() (float64, float64)
}

type PriorityQueue added in v0.0.5

type PriorityQueue []*PriorityQueueItem

func (PriorityQueue) Len added in v0.0.5

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less added in v0.0.5

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop added in v0.0.5

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push added in v0.0.5

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap added in v0.0.5

func (pq PriorityQueue) Swap(i, j int)

type PriorityQueueItem added in v0.0.5

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

Jump to

Keyboard shortcuts

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