Skip to content

kirves/godijkstra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Dijkstra

Build Status

Description

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.

Installation

This package can be installed with the go get command:

go get github.com/kirves/godijkstra/dijkstra

Example

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).

Documentation

API documentation can be found here: http://godoc.org/github.com/kirves/godijkstra/dijkstra

About

Dijkstra package for Go language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages