def test_vertex_count(self) -> None: g = Graph([(1, 2), (2, 3), (3, 4)]) assert g.vertex_count == 4, "graph should have 4 vertices" g.add_vertex(5) assert g.vertex_count == 5, "graph should have 5 vertices" g.remove_vertex(5) assert g.vertex_count == 4, "graph should have 4 vertices"
def test_remove_vertex(self) -> None: g = Graph([(1, 2), (3, 3)]) g.add_vertex(4) assert g.has_vertex(4), "graph should have vertex 4" g.remove_vertex(4) assert not g.has_vertex( 4), "graph should not have vertex 4 after removal" assert g.has_vertex(3), "graph should have semi-isolated vertex 3" g.remove_vertex(3) assert not g.has_vertex( 3), "graph should not have vertex 3 after removal" with pytest.raises(exception.VertizeeException): g.remove_vertex(1)