def test_add_regular_edges_0(self): g = Graph() g.add_regular_edges(0) assert g.vertices() == [] assert g.edges() == [] g = Graph([v, w, x]) g.add_regular_edges(0) assert sorted(g.vertices()) == sorted([v, x, w]) assert g.edges() == []
def test_add_all_edges(self): g = Graph([v, x, w]) g.add_all_edges() assert sorted(g.vertices()) == sorted([v, x, w]) assert len(g.edges()) == 3
def test_add_all_edges_empty(self): g = Graph() g.add_all_edges() assert g.vertices() == [] assert g.edges() == []
def test_edges(self): g = Graph([v, w], [vw, ]) assert g.edges() == [vw, ] g = Graph([v, w, x], [vw, vx]) assert set(g.edges()) == set([vx, vw])
def test_add_regular_edges_even(self): g = Graph([v, w, x]) g.add_regular_edges(2) assert set(g.edges()) == set([vw, vx, wx])