diff options
Diffstat (limited to 'algorithms.py')
| -rw-r--r-- | algorithms.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/algorithms.py b/algorithms.py index 1a62118..de954f4 100644 --- a/algorithms.py +++ b/algorithms.py @@ -1,5 +1,6 @@ import math + def length_haversine(p1, p2): lat1 = p1.lat lng1 = p1.lng @@ -10,14 +11,16 @@ def length_haversine(p1, p2): dlng = lng2 - lng1 a = math.sin(dlat / 2) ** 2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlng / 2) ** 2 c = 2 * math.asin(math.sqrt(a)) - - return 6372797.560856 * c # return the distance in meters + + return 6372797.560856 * c # return the distance in meters + def get_closest_node_id(nodes, source_node): """ Search through all nodes and return the id of the node that is closest to 'source_node'. """ pass + def find_shortest_path(nodes, source_id, target_id): """ Return the shortest path using Dijkstra's algortihm. """ - return []
\ No newline at end of file + return [] |
