Created
July 15, 2019 07:15
-
-
Save douglasmakey/a881d215490ed6d9a55bfe881ca9db34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println("Dijkstra") | |
// Example | |
graph := newGraph() | |
graph.addEdge("S", "B", 4) | |
graph.addEdge("S", "C", 2) | |
graph.addEdge("B", "C", 1) | |
graph.addEdge("B", "D", 5) | |
graph.addEdge("C", "D", 8) | |
graph.addEdge("C", "E", 10) | |
graph.addEdge("D", "E", 2) | |
graph.addEdge("D", "T", 6) | |
graph.addEdge("E", "T", 2) | |
fmt.Println(graph.getPath("S", "T")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment