Class PriorityQueue<T>
A collection that provides efficient extraction of the minimum element.
Inheritance
PriorityQueue<T>
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
public class PriorityQueue<T>
Type Parameters
Constructors
PriorityQueue()
Declaration
PriorityQueue(IComparer<T>)
Declaration
public PriorityQueue(IComparer<T> comparer)
Parameters
PriorityQueue(IEnumerable<T>)
Create a priority queue initialized with the contents of list.
Declaration
public PriorityQueue(IEnumerable<T> list)
Parameters
PriorityQueue(IEnumerable<T>, Action<T, Int32>)
Create a priority queue initialized with the contents of list.
Declaration
public PriorityQueue(IEnumerable<T> list, Action<T, int> moved)
Parameters
PriorityQueue(IEnumerable<T>, IComparer<T>)
Create a priority queue initialized with the contents of list.
Declaration
public PriorityQueue(IEnumerable<T> list, IComparer<T> comparer)
Parameters
PriorityQueue(IEnumerable<T>, IComparer<T>, Action<T, Int32>)
Create a priority queue initialized with the contents of list.
Declaration
public PriorityQueue(IEnumerable<T> list, IComparer<T> comparer, Action<T, int> moved)
Parameters
PriorityQueue(Int32)
Create a priority queue filled with count items equal to default(T).
Declaration
public PriorityQueue(int count)
Parameters
Type |
Name |
Description |
Int32 |
count |
|
PriorityQueue(Int32, IComparer<T>)
Create a priority queue filled with count items equal to default(T).
Declaration
public PriorityQueue(int count, IComparer<T> comparer)
Parameters
Fields
Comparer
Declaration
public IComparer<T> Comparer
Field Value
Items
Declaration
Field Value
Properties
Count
Declaration
public int Count { get; }
Property Value
Item[Int32]
Declaration
public T this[int index] { get; set; }
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Property Value
Methods
Add(T)
Add a new item to the queue.
Declaration
Parameters
Type |
Name |
Description |
T |
item |
|
AddRange(IEnumerable<T>)
Add several new items to the queue.
Declaration
public void AddRange(IEnumerable<T> items)
Parameters
Changed(Int32)
Reposition node i to restore the heap property.
Declaration
public void Changed(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
|
Clear()
Declaration
Clone()
Declaration
public PriorityQueue<T> Clone()
Returns
Contains(T)
Declaration
public bool Contains(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Declaration
public T ExtractMinimum()
Returns
IndexOf(T)
Declaration
public int IndexOf(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Left(Int32)
Declaration
protected int Left(int index)
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Returns
LessThan(Int32, Int32)
Declaration
public bool LessThan(int i, int j)
Parameters
Returns
Parent(Int32)
Declaration
protected int Parent(int index)
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Returns
RemoveAt(Int32)
Remove the item at Items[i]
Declaration
public void RemoveAt(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
Position in the Items array
|
Right(Int32)
Declaration
protected int Right(int index)
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Returns
SiftAll()
Rearrange all items to satisfy the heap property.
Declaration
SiftDown(Int32)
Move Items[i] downward until it is less than or equal to its children.
Declaration
public void SiftDown(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
|
SiftUp(Int32)
Move Items[i] upward until it is greater than or equal to its parent.
Declaration
public void SiftUp(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
An index into Items.
|
ToString()
Declaration
public override string ToString()
Returns
Overrides
Events
Moved
Raised when an item has changed position or been removed (-1).
Declaration
public event Action<T, int> Moved
Event Type