Class FibonacciHeap<TPriority, TValue>
Heap following Fibonacci rules.
Inheritance
Implements
Inherited Members
Namespace: QuikGraph.Collections
Assembly: QuikGraph.dll
Syntax
[Serializable]
public sealed class FibonacciHeap<TPriority, TValue> : IEnumerable<KeyValuePair<TPriority, TValue>>, IEnumerable
Type Parameters
Name | Description |
---|---|
TPriority | Priority metric type. |
TValue | Value type. |
Constructors
| Improve this Doc View SourceFibonacciHeap()
Initializes a new instance of the FibonacciHeap<TPriority, TValue> class.
Declaration
public FibonacciHeap()
FibonacciHeap(HeapDirection)
Initializes a new instance of the FibonacciHeap<TPriority, TValue> class.
Declaration
public FibonacciHeap(HeapDirection direction)
Parameters
Type | Name | Description |
---|---|---|
HeapDirection | direction | Heap direction. |
FibonacciHeap(HeapDirection, Comparison<TPriority>)
Initializes a new instance of the FibonacciHeap<TPriority, TValue> class.
Declaration
public FibonacciHeap(HeapDirection direction, Comparison<TPriority> priorityComparison)
Parameters
Type | Name | Description |
---|---|---|
HeapDirection | direction | Heap direction. |
System.Comparison<TPriority> | priorityComparison | Priority comparer. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Properties
| Improve this Doc View SourceCount
Number of element.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Direction
Heap direction.
Declaration
public HeapDirection Direction { get; }
Property Value
Type | Description |
---|---|
HeapDirection |
IsEmpty
Checks if the heap is empty.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
PriorityComparison
Priority comparer.
Declaration
public Comparison<TPriority> PriorityComparison { get; }
Property Value
Type | Description |
---|---|
System.Comparison<TPriority> |
Top
Top element of the heap.
Declaration
public FibonacciHeapCell<TPriority, TValue> Top { get; }
Property Value
Type | Description |
---|---|
FibonacciHeapCell<TPriority, TValue> |
Methods
| Improve this Doc View SourceChangeKey(FibonacciHeapCell<TPriority, TValue>, TPriority)
Changes the priority of the given cell
.
Declaration
public void ChangeKey(FibonacciHeapCell<TPriority, TValue> cell, TPriority newPriority)
Parameters
Type | Name | Description |
---|---|---|
FibonacciHeapCell<TPriority, TValue> | cell | Cell to update the priority. |
TPriority | newPriority | New priority. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
Delete(FibonacciHeapCell<TPriority, TValue>)
Deletes the given cell
from this heap.
Declaration
public void Delete(FibonacciHeapCell<TPriority, TValue> cell)
Parameters
Type | Name | Description |
---|---|---|
FibonacciHeapCell<TPriority, TValue> | cell | Cell to delete. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Dequeue()
Dequeues an element from the heap.
Declaration
public KeyValuePair<TPriority, TValue> Dequeue()
Returns
Type | Description |
---|---|
System.Collections.Generic.KeyValuePair<TPriority, TValue> | Removed element. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The heap is empty. |
DrawHeap()
Draws the current heap in a string. Marked cells have an * next to them.
Declaration
public string DrawHeap()
Returns
Type | Description |
---|---|
System.String | Heap string representation. |
Enqueue(TPriority, TValue)
Enqueues an element in the heap.
Declaration
public FibonacciHeapCell<TPriority, TValue> Enqueue(TPriority priority, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TPriority | priority | Value priority. |
TValue | value | Value to add. |
Returns
Type | Description |
---|---|
FibonacciHeapCell<TPriority, TValue> |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
GetDestructiveEnumerator()
Enumerator for this heap that Dequeue() elements in the same time.
Declaration
public IEnumerable<KeyValuePair<TPriority, TValue>> GetDestructiveEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TPriority, TValue>> | Heap elements. |
GetEnumerator()
Declaration
public IEnumerator<KeyValuePair<TPriority, TValue>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TPriority, TValue>> |
Merge(FibonacciHeap<TPriority, TValue>)
Merges the given heap
into this heap.
Declaration
public void Merge(FibonacciHeap<TPriority, TValue> heap)
Parameters
Type | Name | Description |
---|---|---|
FibonacciHeap<TPriority, TValue> | heap | Heap to merge. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.InvalidOperationException |
|
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |