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

Method __str__

graphs/minimum_spanning_tree_boruvka.py:57–66  ·  view source on GitHub ↗

Returns string representation of the graph

(self)

Source from the content-addressed store, hash-verified

55 self.adjacency[tail][head] = weight
56
57 def __str__(self):
58 """
59 Returns string representation of the graph
60 """
61 string = ""
62 for tail in self.adjacency:
63 for head in self.adjacency[tail]:
64 weight = self.adjacency[head][tail]
65 string += f"{head} -> {tail} == {weight}\n"
66 return string.rstrip("\n")
67
68 def get_edges(self):
69 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected