def test_empty_graph(self): MST, cost = kruskal(self.G5, self.num_nodes5) self.assertEqual(MST, self.correct_MST5) self.assertEqual(cost, self.correct_cost5)
def test_disconnected_graph(self): MST, cost = kruskal(sorted(self.G4, key=lambda tup: tup[0]), self.num_nodes4) self.assertEqual(MST, self.correct_MST4) self.assertEqual(cost, self.correct_cost4)
def test_triangle_graph(self): MST, cost = kruskal(sorted(self.G2, key=lambda tup: tup[0]), self.num_nodes2) self.assertEqual(MST, self.correct_MST2) self.assertEqual(cost, self.correct_cost2)
def test_trickier_mst(self): MST, cost = kruskal(sorted(self.G3, key=lambda tup: tup[0]), self.num_nodes3) self.assertEqual(MST, self.correct_MST3) self.assertEqual(cost, self.correct_cost3)
def test_linear_graph(self): MST, cost = kruskal(sorted(self.G1, key=lambda tup: tup[0]), self.num_nodes1) self.assertEqual(MST, self.correct_MST1) self.assertEqual(cost, self.correct_cost1)