summaryrefslogtreecommitdiffstats
path: root/algorithms.py
diff options
context:
space:
mode:
Diffstat (limited to 'algorithms.py')
-rw-r--r--algorithms.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/algorithms.py b/algorithms.py
index 6e01287..ba06641 100644
--- a/algorithms.py
+++ b/algorithms.py
@@ -58,7 +58,7 @@ def find_shortest_path(nodes, source_id, target_id):
continue
# otherwise this MIGHT be the shortest walk to neighbour
# so put it in the queue
- new_dist = walk_dist + length_haversine(nodes[walk_end], neighbour)
+ new_dist = walk_dist + length_haversine(nodes[walk_end], neighbour) + length_haversine(neighbour, nodes[target_id])
new_walk = walk + (neighbour.id,)
heapq.heappush(queue, (new_dist, new_walk))
# no path found