-
-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Is your feature request related to a problem? Please describe.
When wanting to clear e.g. a FibonacciQueue there is as far as I can see no efficient way to do this.
An inefficient way is to repeatedly call dequeue until it is empty, but that causes unnecessary updates of the data structure to maintain the invariants for each call to Dequeue.
while (queue.Count > 0) // Dispose all calculation items
{
_ = queue.Dequeue();
}Describe the solution you'd like
BCL collection types like List<T> and Dictionary<TKey, TValue> have a Clear() method to empty them.
It would be nice for all/most QuikGraph collections to have a similar method.
The ones I have seen missing a Clear are:
BinaryQueue,BinaryQueue,FibonacciQueue,FibonacciHeap,FibonacciHeapLinkedListForestDisjointSet
If acceptable IQueue<T> and IDisjointSet<T> could have a void Clear() added, but that is technically a breaking change if any consumers have already implemented those interfaces.
Describe alternatives you've considered
Additional context
I'd be happy to do the implementation and testing of this.