This is a library for the Go programming language implementing the Dijkstra, Dijkstra bidirectional and Yen's graph search algorithms. It works with any graph object implementing the GraphObject interface, having therefore means of getting the successors and predecessors of any graph node and the weight of any edge in the graph.
This package can be installed with the go get command:
go get github.com/kirves/godijkstra/dijkstra
After creating a graph object it is simply a matter of calling the desired search algorithm function:
path, valid := dijkstra.SearchPath(graph, "START", "END", dijkstra.VANILLA)
for standard Dijkstra algorithm
or
path, valid := dijkstra.SearchPath(graph, "START", "END", dijkstra.BIDIR)
for the bidirectional version of the algorithm.
Yen's algorithm returns the k-shortest paths from a graph, using both a search algorithm and a deviation algorithm:
paths := yen.Yen(graph, "START", "END", k, searchFunc)
where k is the number of paths to find and searchFunc is the search algorithm to use (the Dijkstra algorithm implemented in this package is fine).
API documentation can be found here: http://godoc.org/github.com/kirves/godijkstra/dijkstra