mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Add doctest to dijkstra-algorithm
This commit is contained in:
parent
82f098612a
commit
45baaf74a9
@ -9,17 +9,17 @@ 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("Vertex Distance")
|
||||
print("\nVertex Distance")
|
||||
for i in range(v):
|
||||
if dist[i] != float("inf"):
|
||||
print(i, "\t", int(dist[i]), end="\t")
|
||||
print(i, int(dist[i]), end=" ")
|
||||
else:
|
||||
print(i, "\t", "INF", end="\t")
|
||||
print(i, "INF", end=" ")
|
||||
print()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user