From 53a4135160e973bd535c69ab5cf7784aff173494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Thu, 3 Dec 2020 14:47:35 +0100 Subject: timing formatting --- algorithms.py | 4 ++-- store.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/algorithms.py b/algorithms.py index d0988ee..78aac94 100644 --- a/algorithms.py +++ b/algorithms.py @@ -31,7 +31,7 @@ def get_closest_node_id(nodes, source_node): min_node = node_id min_value = length - print(f"Found the closest node in {time.monotonic() - start} s") + print(f"Found the closest node in {time.monotonic() - start:.3} s") return min_node @@ -51,7 +51,7 @@ def find_shortest_path(nodes, source_id, target_id): walk_end = walk[-1] if walk_end == target_id: # you have reached your destination - print(f"Found a path in {time.monotonic() - start} s") + print(f"Found a path in {time.monotonic() - start:.3} s") return walk if walk_end in visited: # there exists a shorter walk to walk_end diff --git a/store.py b/store.py index ba2e4ef..e7c1018 100644 --- a/store.py +++ b/store.py @@ -51,7 +51,7 @@ def extract_osm_nodes(f_name): if not node.neighbours: del nodes[node_id] - print(f"Extracted {len(nodes)} nodes in {time.monotonic() - start} s") + print(f"Extracted {len(nodes)} nodes in {time.monotonic() - start:.3} s") return nodes -- cgit v1.2.1