Show the distances from src to all other nodes in a graph Examples: >>> graph_test = Graph(1) >>> graph_test.show_distances(0) Distance from node: 0 Node 0 has distance: 0
(self, src)
| 378 | self.show_distances(src) |
| 379 | |
| 380 | def show_distances(self, src): |
| 381 | """ |
| 382 | Show the distances from src to all other nodes in a graph |
| 383 | |
| 384 | Examples: |
| 385 | >>> graph_test = Graph(1) |
| 386 | >>> graph_test.show_distances(0) |
| 387 | Distance from node: 0 |
| 388 | Node 0 has distance: 0 |
| 389 | """ |
| 390 | print(f"Distance from node: {src}") |
| 391 | for u in range(self.num_nodes): |
| 392 | print(f"Node {u} has distance: {self.dist[u]}") |
| 393 | |
| 394 | def show_path(self, src, dest): |
| 395 | """ |