This repository implements Single Source Shortest Paths (SSSP) algorithms in Go. SSSP algorithms find the shortest paths from a given source vertex to all other vertices in a weighted graph.
- Graph data structure implementation
- Priority queue for efficient shortest path computation
- SSSP algorithm (e.g., Dijkstra's algorithm)
- Example usage in
main.go
graph.go
: Graph representation and related methodspriority_queue.go
: Priority queue implementationsingle_source_shortest_paths.go
: SSSP algorithm implementationdata_structure.go
: Supporting data structuresmain.go
: Entry point and example usagego.mod
: Go module definition
- Clone the repository:
git clone github.com/yothgewalt/single-source-shortest-paths.git cd single-source-shortest-paths
- Run the example:
go run main.go
Below is a simple example of how to use the SSSP algorithm:
// ...existing code...
source := 0
shortestPaths := SSSP(graph, source)
fmt.Println("Shortest paths from source:", shortestPaths)
// ...existing code...
- Dijkstra's Algorithm (for graphs with non-negative weights)