Class BinaryQueue<TVertex, TDistance>
Priority queue to sort vertices by distance priority (use BinaryHeap<TPriority, TValue>).
Inheritance
Inherited Members
Namespace: QuikGraph.Collections
Assembly: QuikGraph.dll
Syntax
[Serializable]
public sealed class BinaryQueue<TVertex, TDistance> : IPriorityQueue<TVertex>, IQueue<TVertex>
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TDistance | Distance type. |
Constructors
| Improve this Doc View SourceBinaryQueue(Func<TVertex, TDistance>)
Initializes a new instance of the BinaryQueue<TVertex, TDistance> class.
Declaration
public BinaryQueue(Func<TVertex, TDistance> distanceFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Func<TVertex, TDistance> | distanceFunc | Function that compute the distance for a given vertex. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
BinaryQueue(Func<TVertex, TDistance>, Comparison<TDistance>)
Initializes a new instance of the BinaryQueue<TVertex, TDistance> class.
Declaration
public BinaryQueue(Func<TVertex, TDistance> distanceFunc, Comparison<TDistance> distanceComparison)
Parameters
Type | Name | Description |
---|---|---|
System.Func<TVertex, TDistance> | distanceFunc | Function that compute the distance for a given vertex. |
System.Comparison<TDistance> | distanceComparison | Comparer of distances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
Properties
| Improve this Doc View SourceCount
Number of elements.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceContains(TVertex)
Checks if this queue contains the given value
.
Declaration
public bool Contains(TVertex value)
Parameters
Type | Name | Description |
---|---|---|
TVertex | value |
Returns
Type | Description |
---|---|
System.Boolean | True if the |
Dequeue()
Dequeues an element from the queue.
Declaration
public TVertex Dequeue()
Returns
Type | Description |
---|---|
TVertex | Removed element. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Queue is empty. |
Enqueue(TVertex)
Enqueues an element in the queue.
Declaration
public void Enqueue(TVertex value)
Parameters
Type | Name | Description |
---|---|---|
TVertex | value |
Peek()
Returns the element at the beginning of the queue.
Declaration
public TVertex Peek()
Returns
Type | Description |
---|---|
TVertex | The top queue element. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Queue is empty. |
ToArray()
Converts this queue to an array.
Declaration
public TVertex[] ToArray()
Returns
Type | Description |
---|---|
TVertex[] | Array composed of elements. |
ToPairsArray()
Converts this queue to an array of vertices associated to their distances.
Declaration
public KeyValuePair<TDistance, TVertex>[] ToPairsArray()
Returns
Type | Description |
---|---|
System.Collections.Generic.KeyValuePair<TDistance, TVertex>[] | Array composed of elements. |
ToString2()
Gets an alternative string representation.
Declaration
public string ToString2()
Returns
Type | Description |
---|---|
System.String | String representation. |
Update(TVertex)
Updates the given value
priority.
Declaration
public void Update(TVertex value)
Parameters
Type | Name | Description |
---|---|---|
TVertex | value |