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

Function test_vector

graphs/boruvka.py:141–170  ·  view source on GitHub ↗

>>> g = Graph(8) >>> for u_v_w in ((0, 1, 10), (0, 2, 6), (0, 3, 5), (1, 3, 15), (2, 3, 4), ... (3, 4, 8), (4, 5, 10), (4, 6, 6), (4, 7, 5), (5, 7, 15), (6, 7, 4)): ... g.add_edge(*u_v_w) >>> g.boruvka() Added edge [0 - 3] Added weight: 5 Ad

()

Source from the content-addressed store, hash-verified

139
140
141def test_vector() -> None:
142 """
143 >>> g = Graph(8)
144 >>> for u_v_w in ((0, 1, 10), (0, 2, 6), (0, 3, 5), (1, 3, 15), (2, 3, 4),
145 ... (3, 4, 8), (4, 5, 10), (4, 6, 6), (4, 7, 5), (5, 7, 15), (6, 7, 4)):
146 ... g.add_edge(*u_v_w)
147 >>> g.boruvka()
148 Added edge [0 - 3]
149 Added weight: 5
150 <BLANKLINE>
151 Added edge [0 - 1]
152 Added weight: 10
153 <BLANKLINE>
154 Added edge [2 - 3]
155 Added weight: 4
156 <BLANKLINE>
157 Added edge [4 - 7]
158 Added weight: 5
159 <BLANKLINE>
160 Added edge [4 - 5]
161 Added weight: 10
162 <BLANKLINE>
163 Added edge [6 - 7]
164 Added weight: 4
165 <BLANKLINE>
166 Added edge [3 - 4]
167 Added weight: 8
168 <BLANKLINE>
169 The total weight of the minimal spanning tree is: 46
170 """
171
172
173if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected