Skip to content

Commit 53ce373

Browse files
committed
fix issue #39756
1 parent 4cdd703 commit 53ce373

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/sage/graphs/bipartite_graph.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,15 @@ def __init__(self, data=None, partition=None, check=True, hash_labels=None, *arg
401401
Traceback (most recent call last):
402402
...
403403
TypeError: this graph is immutable and so cannot be changed
404+
405+
Check that :issue:`39756` is fixed::
406+
407+
sage: B = BipartiteGraph([(0,2), (0,3), (1,2), (1,3)])
408+
sage: B.left, B.right
409+
({0, 1}, {2, 3})
410+
sage: B.clear()
411+
sage: B.left, B.right
412+
(set(), set())
404413
"""
405414
if kwds is None:
406415
kwds = {'loops': False}
@@ -943,7 +952,20 @@ def delete_vertices(self, vertices):
943952
Traceback (most recent call last):
944953
...
945954
ValueError: vertex (0) not in the graph
955+
956+
TESTS:
957+
958+
Check that :issue:`39756` is fixed::
959+
960+
sage: B = BipartiteGraph([(0,2), (0,3), (1,2), (1,3)])
961+
sage: B.left, B.right
962+
({0, 1}, {2, 3})
963+
sage: B.delete_vertices(B.vertex_iterator())
964+
sage: B.left, B.right
965+
(set(), set())
946966
"""
967+
vertices = list(vertices)
968+
947969
# remove vertices from the graph
948970
Graph.delete_vertices(self, vertices)
949971

0 commit comments

Comments
 (0)