Packagecom.yworks.yfiles.util.pq
Classpublic class BHeapDoubleNodePQ
InheritanceBHeapDoubleNodePQ Inheritance YObject Inheritance Object
Implements DoubleNodePQ

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

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

Returns the minimum priority value in this queue.


Implementation
    public function get minPriority():Number
Constructor Detail
BHeapDoubleNodePQ()Constructor
public function BHeapDoubleNodePQ(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, value:Number):void

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

Precondition !contains(v)

Complexity O(log(size()))

Parameters

v:Node
 
value:Number

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

Changes the priority value of the given node.

Precondition contains(v)

Complexity O(log(size()))

Parameters

v:Node
 
p:Number

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:Number):void

Decreases the priority value of the given node.

Precondition contains(v)

Precondition c.compare(p,getPriority(v)) < 0, where c is the corresponding comparator for the priorities in this queue.

Complexity O(log(size()))

Parameters

v:Node
 
priority:Number

dispose()method 
public function dispose():void

Does nothing.

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

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

Returns the current priority of the given node.

Precondition contains(v)

Parameters

v:Node

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

Parameters

v:Node
 
priority:Number

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

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

Parameters

graph:Graph

See also

newBHeapDoubleNodePQ()method 
public static function newBHeapDoubleNodePQ(graph:Graph):BHeapDoubleNodePQ

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
BHeapDoubleNodePQ
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