summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--algorithms.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/algorithms.py b/algorithms.py
index 7ff395c..f8d2e50 100644
--- a/algorithms.py
+++ b/algorithms.py
@@ -77,7 +77,6 @@ def get_closest_node(nodes, source_node):
for node in nodes:
length = length_haversine(source_node, node)
-
if (min_node is None or length < min_value):
min_node = node
min_value = length
@@ -103,13 +102,10 @@ def find_shortest_path(nodes, source_id, target_id):
if walk_end in visited:
# there exists a shorter walk to walk_end
continue
-
# otherwise this is the shortest walk to walk_end
visited.add(walk_end)
# consider all our neighbours
- end_node = nodes[walk_end]
-
- for neighbour in end_node.neighbours:
+ for neighbour in nodes[walk_end].neighbours:
if neighbour in visited:
# there exists a shorter walk to neighbour
continue