Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
dijkstra
✓ github.com/RyanCarrier/dijkstra
Computes the shortest path between two vertices in a weighted graph.
package main
import (
"fmt"
"github.com/RyanCarrier/dijkstra"
)
func main() {
graph := dijkstra.NewGraph()
graph.AddVertex(0)
graph.AddVertex(1)
graph.AddArc(0, 1, 5)
bestPath, err := graph.Shortest(0, 1)
if err != nil {
fmt.Println("No path found")
return
}
fmt.Printf("Shortest distance: %d\n", bestPath.Distance)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.4.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.