Packagecom.yworks.yfiles.util.pq
Classpublic class BHeapIntNodePQ
InheritanceBHeapIntNodePQ Inheritance YObject Inheritance Object
Implements IntNodePQ

This class implements a priority queue for nodes whose priority values are of type int.

The implementation is based on binary heaps.



Public Properties
 PropertyDefined By
  empty : Boolean
[read-only] Returns whether or not this queue is empty Complexity O(1)
BHeapIntNodePQ
  min : Node
[read-only] Returns he node with smallest priority in this queue.
BHeapIntNodePQ
  minPriority : int
[read-only] Returns the minimum priority value in this queue.
BHeapIntNodePQ
Public Methods
 MethodDefined By
  
BHeapIntNodePQ(graph:Graph, init:Boolean = true)
Creates an empty NodePQ for nodes contained in the given graph.
BHeapIntNodePQ
  
add(v:Node, priority:int):void
Adds the given node with with given priority to this queue.
BHeapIntNodePQ
  
changePriority(v:Node, p:int):void
Changes the priority value of the given node.
BHeapIntNodePQ
  
clear():void
Makes this queue the empty queue.
BHeapIntNodePQ
  
contains(v:Node):Boolean
Returns whether or not the given node is contained in this queue.
BHeapIntNodePQ
  
decreasePriority(v:Node, priority:int):void
Decreases the priority value of the given node.
BHeapIntNodePQ
  
dispose():void
Does nothing.
BHeapIntNodePQ
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
BHeapIntNodePQ
  
Returns the current priority of the given node.
BHeapIntNodePQ
 Inherited
hashCode():int
YObject
  
increasePriority(v:Node, priority:int):void
Increases the priority value of the given node.
BHeapIntNodePQ
  
[static] Creates an empty NodePQ for nodes contained in the given graph.
BHeapIntNodePQ
  
remove(v:Node):void
Removes the given node from this queue.
BHeapIntNodePQ
  
Removes the node with smallest priority from this queue Precondition !isEmpty() Complexity O(log(size()))
BHeapIntNodePQ
  
size():int
Returns the number of nodes currently in this queue Complexity O(1)
BHeapIntNodePQ
Protected Methods
 MethodDefined By
  
Initializes this object.
BHeapIntNodePQ
Property Detail
emptyproperty
empty:Boolean  [read-only]

Returns whether or not this queue is empty

Complexity O(1)


Implementation
    public function get empty():Boolean
minproperty 
min:Node  [read-only]

Returns he node with smallest priority in this queue.

Precondition !isEmpty()


Implementation
    public function get min():Node
minPriorityproperty 
minPriority:int  [read-only]

Returns the minimum priority value in this queue.


Implementation
    public function get minPriority():int
Constructor Detail
BHeapIntNodePQ()Constructor
public function BHeapIntNodePQ(graph:Graph, init:Boolean = true)

Creates an empty NodePQ for nodes contained in the given graph. Neither the node set nor the indices of the nodes of the given graph may change while this queue is being used.

Parameters
graph:Graph
 
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
add()method
public function add(v:Node, priority:int):void

Adds the given node with with given priority to this queue.

Precondition !contains(v)

Complexity O(log(size()))

Parameters

v:Node
 
priority:int

changePriority()method 
public function changePriority(v:Node, p:int):void

Changes the priority value of the given node.

Precondition contains(v)

Complexity O(log(size()))

Parameters

v:Node
 
p:int

clear()method 
public function clear():void

Makes this queue the empty queue. in this queue.

Complexity O(graph.N())

contains()method 
public function contains(v:Node):Boolean

Returns whether or not the given node is contained in this queue.

Complexity O(1)

Parameters

v:Node

Returns
Boolean
decreasePriority()method 
public function decreasePriority(v:Node, priority:int):void

Decreases the priority value of the given node.

Precondition contains(v)

Precondition priority < getPriority(v)

Complexity O(log(size()))

Parameters

v:Node
 
priority:int

dispose()method 
public function dispose():void

Does nothing.

getClass()method 
override public function getClass():Class

Returns
Class
getPriority()method 
public function getPriority(v:Node):int

Returns the current priority of the given node.

Precondition contains(v)

Parameters

v:Node

Returns
int
increasePriority()method 
public function increasePriority(v:Node, priority:int):void

Increases the priority value of the given node.

Precondition contains(v)

Precondition priority > getPriority(v)

Complexity O(log(size()))

Parameters

v:Node
 
priority:int

initBHeapIntNodePQ()method 
protected final function initBHeapIntNodePQ(graph:Graph):void

Initializes this object. See the documentation of the corresponding factory method newBHeapIntNodePQ() for details.

Parameters

graph:Graph

See also

newBHeapIntNodePQ()method 
public static function newBHeapIntNodePQ(graph:Graph):BHeapIntNodePQ

Creates an empty NodePQ for nodes contained in the given graph. Neither the node set nor the indices of the nodes of the given graph may change while this queue is being used.

Parameters

graph:Graph

Returns
BHeapIntNodePQ
remove()method 
public function remove(v:Node):void

Removes the given node from this queue.

Precondition contains(v)

Complexity O(log(size()))

Parameters

v:Node

removeMin()method 
public function removeMin():Node

Removes the node with smallest priority from this queue

Precondition !isEmpty()

Complexity O(log(size()))

Returns
Node — the removed node with smallest priority
size()method 
public function size():int

Returns the number of nodes currently in this queue

Complexity O(1)

Returns
int