MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / print_solution

Method print_solution

graphs/dijkstra_alternate.py:18–25  ·  view source on GitHub ↗

>>> Graph(0).print_solution([]) # doctest: +NORMALIZE_WHITESPACE Vertex Distance from Source

(self, distances_from_source: list[int])

Source from the content-addressed store, hash-verified

16 self.graph = [[0] * vertices for _ in range(vertices)]
17
18 def print_solution(self, distances_from_source: list[int]) -> None:
19 """
20 >>> Graph(0).print_solution([]) # doctest: +NORMALIZE_WHITESPACE
21 Vertex Distance from Source
22 """
23 print("Vertex \t Distance from Source")
24 for vertex in range(self.vertices):
25 print(vertex, "\t\t", distances_from_source[vertex])
26
27 def minimum_distance(
28 self, distances_from_source: list[int], visited: list[bool]

Callers 1

dijkstraMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected