mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 09:10:16 +00:00
editing doctest
This commit is contained in:
parent
e1ad21cd6a
commit
199db30829
|
@ -39,17 +39,13 @@ def floyd_warshall(graph, v):
|
||||||
... [float('inf'), float('inf'), float('inf')],
|
... [float('inf'), float('inf'), float('inf')],
|
||||||
... [float('inf'), float('inf'), float('inf')]
|
... [float('inf'), float('inf'), float('inf')]
|
||||||
... ]
|
... ]
|
||||||
>>> for i in range(num_vertices):
|
|
||||||
... graph[i][i] = 0.0
|
|
||||||
>>> graph[0][1] = 2
|
|
||||||
>>> graph[1][0] = 1
|
|
||||||
>>> expected = [
|
>>> expected = [
|
||||||
... [0, 2, float('inf')],
|
... [0, 2, float('inf')],
|
||||||
... [1, 0, float('inf')],
|
... [1, 0, float('inf')],
|
||||||
... [float('inf'), float('inf'), 0]
|
... [float('inf'), float('inf'), 0]
|
||||||
... ]
|
... ]
|
||||||
>>> dist, _ = floyd_warshall(graph, num_vertices)
|
>>> dist, _ = floyd_warshall(graph, num_vertices)
|
||||||
|
|
||||||
The shortest path matrix using Floyd Warshall algorithm
|
The shortest path matrix using Floyd Warshall algorithm
|
||||||
|
|
||||||
0 2 INF
|
0 2 INF
|
||||||
|
|
Loading…
Reference in New Issue
Block a user