From 5457d8cbe22e1c346772d5da6ae4c99dae188b53 Mon Sep 17 00:00:00 2001 From: lubaso Date: Sat, 7 Oct 2023 00:18:09 -0300 Subject: [PATCH] Add doctest to dijkstra-algorithm --- graphs/dijkstra_2.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/graphs/dijkstra_2.py b/graphs/dijkstra_2.py index 832296612..aca3da0ee 100644 --- a/graphs/dijkstra_2.py +++ b/graphs/dijkstra_2.py @@ -9,10 +9,10 @@ def print_dist(dist, v): Example: >>> print_dist([0.0, 2.0, 3.0, float('inf')], 4) Vertex Distance - 0 0 - 1 2 - 2 3 - 3 INF + 0 0 + 1 2 + 2 3 + 3 INF """ print("\nVertex Distance") for i in range(v): @@ -61,10 +61,10 @@ def dijkstra(graph, v, src): ... [1.0, float('inf'), 3.0, 0.0]] >>> dijkstra(graph, 4, 0) Vertex Distance - 0 0 - 1 2 - 2 3 - 3 1 + 0 0 + 1 2 + 2 3 + 3 1 """ mdist = [float("inf") for _ in range(v)] vset = [False for _ in range(v)]