def test_init_one_edge(self): g = BinaryMixedTree(MixedGraph({1, 2}, [(1, 2)])) v_xy = g.add_union(frozenset([1]), frozenset([2])) expected = BinaryMixedTree(MixedGraph({1, 2})) expected.add(frozenset([1, 2])) expected.add_directed(frozenset([1]), frozenset([1, 2])) expected.add_directed(frozenset([2]), frozenset([1, 2])) self.assertEqual(g, expected) self.assertEqual(v_xy, frozenset([1, 2]))
def test_init_one_undirected(self): g = BinaryMixedTree(MixedGraph({0, 1, 2, 3, 4}, [(2, 3)])) g.update(DIRECTED_EDGE, [(frozenset([2]), frozenset([0])), (frozenset([3]), frozenset([1])), (frozenset([3]), frozenset([4]))], node_creation=False) v_xy = g.add_union(frozenset([2]), frozenset([3])) expected = BinaryMixedTree(MixedGraph({0, 1, 2, 3, 4})) expected.add(frozenset([2, 3])) expected.update(DIRECTED_EDGE, [(frozenset([2]), frozenset([0])), (frozenset([3]), frozenset([1])), (frozenset([3]), frozenset([4])), (frozenset([2]), frozenset([2, 3])), (frozenset([3]), frozenset([2, 3]))], node_creation=False) self.assertEqual(g, expected) self.assertEqual(v_xy, frozenset([2, 3]))