Commit dab658c3 authored by Roberts Ivanovs's avatar Roberts Ivanovs
Browse files

Added support for total route distance output

parent fe02949a
......@@ -23,9 +23,10 @@ def mans_cels(city_1, city_2, matrix, cities, block_tuple_list=None):
Returns
-------
list
list containing list and a string [[str, str...], str]
The route from the starting city to the end city as a list of strings
containing city names
containing city names. The second element is the total
distance for the route between starting city to end city.
"""
print(f"Finding the route between {city_1} and {city_2}")
......@@ -96,7 +97,7 @@ def mans_cels(city_1, city_2, matrix, cities, block_tuple_list=None):
break
route.reverse()
return route
return (route, str(sum_dist[end_node]))
curr_node = curr_smallest_id
......@@ -113,7 +114,9 @@ def user_friendly_route_formatter(route):
string
A string formatted for the end user to see
"""
return "road: "+str(" uz ".join(route))
cities = route[0]
distance = route[1]
return "road: "+str(" uz ".join(cities))+" in "+distance+" km."
if __name__ == "__main__":
matrix_data = generate_matrix()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment