def test_graph_remove_edges(): G = Graph([1, 2, 3, 4, 5], [(1, 2), (2, 3), (3, 4), (4, 5), (1, 5)]) removed_mobjects = G.remove_edges((1, 2)) assert str(removed_mobjects.submobjects) == "[Line]" assert str(G) == "Graph on 5 vertices and 4 edges" assert set(G.edges.keys()) == {(2, 3), (3, 4), (4, 5), (1, 5)} assert set(G._graph.edges()) == set(G.edges.keys()) removed_mobjects = G.remove_edges((2, 3), (3, 4), (4, 5), (5, 1)) assert len(removed_mobjects) == 4 assert str(G) == "Graph on 5 vertices and 0 edges" assert set(G._graph.edges()) == set() assert set(G.edges.keys()) == set()
def test_graph_remove_edges(using_opengl_renderer): G = Graph([1, 2, 3, 4, 5], [(1, 2), (2, 3), (3, 4), (4, 5), (1, 5)]) removed_mobjects = G.remove_edges((1, 2)) assert isinstance(removed_mobjects.submobjects[0], Line) assert len(G.vertices) == 5 assert len(G.edges) == 4 assert set(G.edges.keys()) == {(2, 3), (3, 4), (4, 5), (1, 5)} assert set(G._graph.edges()) == set(G.edges.keys()) removed_mobjects = G.remove_edges((2, 3), (3, 4), (4, 5), (5, 1)) assert len(removed_mobjects) == 4 assert len(G.vertices) == 5 assert len(G.edges) == 0 assert set(G._graph.edges()) == set() assert set(G.edges.keys()) == set()