Class SoftHeap<TKey, TValue>
Soft heap, which aims to has a constant amortized time for creation of heap, inserting an element merging two heaps, deleting an element and finding the element with minimum key.
Inheritance
Implements
Inherited Members
Namespace: QuikGraph.Collections
Assembly: QuikGraph.dll
Syntax
[Serializable]
public sealed class SoftHeap<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Type Parameters
Name | Description |
---|---|
TKey | Key type. |
TValue | Value type. |
Constructors
| Improve this Doc View SourceSoftHeap(Double, TKey)
Initializes a new instance of the SoftHeap<TKey, TValue> class.
Declaration
public SoftHeap(double maximumErrorRate, TKey keyMaxValue)
Parameters
Type | Name | Description |
---|---|---|
System.Double | maximumErrorRate | Indicates the maximum error rate to respect. |
TKey | keyMaxValue | Gives the maximum key value. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentOutOfRangeException |
|
SoftHeap(Double, TKey, Comparison<TKey>)
Initializes a new instance of the SoftHeap<TKey, TValue> class.
Declaration
public SoftHeap(double maximumErrorRate, TKey keyMaxValue, Comparison<TKey> comparison)
Parameters
Type | Name | Description |
---|---|---|
System.Double | maximumErrorRate | Indicates the maximum error rate to respect. |
TKey | keyMaxValue | Gives the maximum key value. |
System.Comparison<TKey> | comparison | Key comparer. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentOutOfRangeException |
|
Properties
| Improve this Doc View SourceCount
Number of element.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ErrorRate
Error rate.
Declaration
public double ErrorRate { get; }
Property Value
Type | Description |
---|---|
System.Double |
KeyComparison
Key comparer.
Declaration
public Comparison<TKey> KeyComparison { get; }
Property Value
Type | Description |
---|---|
System.Comparison<TKey> |
KeyMaxValue
Maximal authorized key.
Declaration
public TKey KeyMaxValue { get; }
Property Value
Type | Description |
---|---|
TKey |
MinRank
Minimal rank (based on ErrorRate).
Declaration
public int MinRank { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceAdd(TKey, TValue)
Adds the given value
with the given key
into the heap.
Declaration
public void Add(TKey key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key. |
TValue | value | Value to add. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|
GetEnumerator()
Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> |
RemoveMinimum()
Gets and removes the minimal pair.
Declaration
public KeyValuePair<TKey, TValue> RemoveMinimum()
Returns
Type | Description |
---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | The minimal pair. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The heap is empty. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |