From 1527c553eaafa8c813834495cf74f8c3332a739a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 9 Nov 2020 14:43:45 +0100 Subject: unweighted a-star --- algorithms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'algorithms.py') 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 -- cgit v1.2.1