astar

package module
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: BSD-2-Clause Imports: 1 Imported by: 0

README

A*

Build Status Coverage Status Go Report Card Go Reference

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cost

type Cost int

type Node

type Node interface {
	Nbs() []Node
	DistanceTo(other Node) Cost
	EstimateTo(other Node) Cost
}

func Astar

func Astar(node0, goal Node) (path []Node)

type QMap added in v0.6.0

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

QMap is a hybrid of priority queue and map, allowing for O(log(N)) Add/Update and O(1) Pop/Get.

Example
fmt.Print(qmapExample())
Output:

[two foo five five2]

func (*QMap) Add added in v0.6.0

func (qm *QMap) Add(v Node, priority Cost)

func (*QMap) Get added in v0.6.0

func (qm *QMap) Get(v Node) (*qitem, bool)

Get returns element which can be updated by Update, plus a bool indicating if it existed.

func (*QMap) Init added in v0.6.0

func (qm *QMap) Init()

func (*QMap) Len added in v0.6.0

func (qm *QMap) Len() int

func (*QMap) Pop added in v0.6.0

func (qm *QMap) Pop() Node

func (*QMap) Update added in v0.6.0

func (qm *QMap) Update(x *qitem, newPriority Cost)

Update can only work on the element obtained by Get.

Directories

Path Synopsis
graphs
geo

Jump to

Keyboard shortcuts

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