diff options
| author | Stefan Hansson <steha708@edu.liu.se> | 2020-12-16 09:26:50 +0100 |
|---|---|---|
| committer | Newbyte <steha708@liu.se> | 2020-12-16 09:26:50 +0100 |
| commit | 3af5a89bdefc20ffdc4b66a5ae2a62a8cbabe36c (patch) | |
| tree | 314edce5140a669409e54cddda61c50b0d3b065f | |
| parent | 1354c8317945ace08145128f03a26ee4e02ddd9e (diff) | |
| download | tdde25-3af5a89bdefc20ffdc4b66a5ae2a62a8cbabe36c.tar.gz | |
More redundant changes removed
| -rw-r--r-- | algorithms.py | 3 | ||||
| -rw-r--r-- | store.py | 1 |
2 files changed, 1 insertions, 3 deletions
diff --git a/algorithms.py b/algorithms.py index f8d2e50..9f3fd78 100644 --- a/algorithms.py +++ b/algorithms.py @@ -77,7 +77,7 @@ 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): + if min_node is None or length < min_value: min_node = node min_value = length @@ -114,6 +114,5 @@ def find_shortest_path(nodes, source_id, target_id): new_dist = walk_dist + length_haversine(nodes[walk_end], neighbour) new_walk = walk + (neighbour.id,) heapq.heappush(queue, (new_dist, new_walk)) - # no path found return None @@ -128,7 +128,6 @@ def make_forest(nodes): # becomes the root of each node since it will be the same for all nodes # in the same tree due our use of union-find. forest = defaultdict(dict) - for node_id, node in nodes.items(): forest[node.find_root().id][node_id] = node |
