mirror of
https://github.com/gonum/gonum.git
synced 2025-10-15 19:50:48 +08:00
Removed dead dijkstra code, fixes #13
This commit is contained in:
@@ -115,7 +115,6 @@ func Dijkstra(source graph.Node, gr graph.Graph, cost graph.CostFunc) (paths map
|
|||||||
|
|
||||||
nodes := gr.NodeList()
|
nodes := gr.NodeList()
|
||||||
openSet := &aStarPriorityQueue{nodes: make([]internalNode, 0), indexList: make(map[int]int)}
|
openSet := &aStarPriorityQueue{nodes: make([]internalNode, 0), indexList: make(map[int]int)}
|
||||||
closedSet := set.NewSet() // This is to make use of that same
|
|
||||||
costs = make(map[int]float64, len(nodes)) // May overallocate, will change if it becomes a problem
|
costs = make(map[int]float64, len(nodes)) // May overallocate, will change if it becomes a problem
|
||||||
predecessor := make(map[int]graph.Node, len(nodes))
|
predecessor := make(map[int]graph.Node, len(nodes))
|
||||||
nodeIDMap := make(map[int]graph.Node, len(nodes))
|
nodeIDMap := make(map[int]graph.Node, len(nodes))
|
||||||
@@ -129,8 +128,6 @@ func Dijkstra(source graph.Node, gr graph.Graph, cost graph.CostFunc) (paths map
|
|||||||
|
|
||||||
nodeIDMap[node.ID()] = node
|
nodeIDMap[node.ID()] = node
|
||||||
|
|
||||||
closedSet.Add(node.ID())
|
|
||||||
|
|
||||||
for _, neighbor := range successors(node) {
|
for _, neighbor := range successors(node) {
|
||||||
tmpCost := costs[node.ID()] + cost(edgeTo(node, neighbor))
|
tmpCost := costs[node.ID()] + cost(edgeTo(node, neighbor))
|
||||||
if cost, ok := costs[neighbor.ID()]; !ok {
|
if cost, ok := costs[neighbor.ID()]; !ok {
|
||||||
|
Reference in New Issue
Block a user