Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/sage/graphs/bipartite_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,25 @@ def __init__(self, data=None, partition=None, check=True, hash_labels=None, *arg
self._hash_labels = hash_labels

return

def clear(self):
"""
Clear all the vertices and edges in the graph.

This method will also clear the left and right vertex sets.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like that would be more informative

This method extends the functionality of method :meth:`~sage.graphs.generic_graph.GenericGraph.clear` to also clear vertex sets `left` and `right`.


EXAMPLES::

sage: B = BipartiteGraph(graphs.CompleteBipartiteGraph(7, 9))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a smaller example like graphs.CycleGraph(4) or even a single edge is sufficient.

sage: B.clear()
sage: B.left
set()
sage: B.right
set()
"""
super().clear()
self.left.clear()
self.right.clear()

@cached_method
def __hash__(self):
Expand Down