Documentation
¶
Index ¶
- Constants
- func CoordToId[T comparable](m *matrix.Matrix[T], c matrix.Coord) int64
- func IdToCoord[T comparable](m *matrix.Matrix[T], id int64) matrix.Coord
- type PathFinder
- func (pf *PathFinder) AddSpecialNode(m *matrix.Matrix[byte], c matrix.Coord, invert bool)
- func (pf *PathFinder) FindAllDijkstra(from, to matrix.Coord) ([][]matrix.Coord, int64)
- func (pf *PathFinder) FindDijkstra(from, to matrix.Coord) ([]matrix.Coord, int64)
- func (pf *PathFinder) Graph() *simple.WeightedDirectedGraph
Constants ¶
View Source
const ( SymbolWall = '#' SymbolEmpty = '.' )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PathFinder ¶
type PathFinder struct {
// contains filtered or unexported fields
}
PathFinder helps find paths within a Matrix[byte].
func NewSimplePathFinder ¶
func NewSimplePathFinder(m *matrix.Matrix[byte]) *PathFinder
NewSimplePathFinder creates a PathFinder
func (*PathFinder) AddSpecialNode ¶
AddSpecialNode adds a new node in the graph at coordinate c. It will search all the reachable neightbors from this point and create path FROM it to these. If invert is true, it will create path from all reachable neighbors TO this point.
func (*PathFinder) FindAllDijkstra ¶
FindDijkstra uses the Dijkstra algorithm to find all shortest paths from a coordinate to another.
func (*PathFinder) FindDijkstra ¶
FindDijkstra uses the Dijkstra algorithm to find a shortest path from a coordinate to another.
func (*PathFinder) Graph ¶
func (pf *PathFinder) Graph() *simple.WeightedDirectedGraph
Graph returns the underlying graph contained in the PathFinder.
Click to show internal directories.
Click to hide internal directories.