|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.util.pq.ListIntNodePQ
A specialized priority queue that contains nodes which are prioritized by associated int values.
This queue is designed for efficency in scenario's where the set of possible integral priority keys is small and tight (i.e their values are not far apart). Typical int values chosen are the degree of a node.
Constructor Summary | |
ListIntNodePQ(Graph graph)
Constructs an initially empty PQ. |
|
ListIntNodePQ(Graph graph,
DataProvider intData,
int minValue,
int maxValue)
Constructs a PQ that holds all nodes of the given graph. |
|
ListIntNodePQ(Graph graph,
DataProvider intData,
int minValue,
int maxValue,
DataProvider wantedNodes)
Like ListIntNodePQ.ListIntNodePQ(Graph,DataProvider,int,int) .
|
Method Summary | |
void |
add(Node v,
int value)
Adds a node to this queue with the given priority |
void |
clear()
Removes all entires from the queue. |
boolean |
contains(Node v)
Whether or not the given node is contained within this queue. |
void |
decreasePriority(Node v,
int value)
Decreases the priority of a node in the queue to a certain value. |
void |
decrementPriority(Node v)
Decrements the associated priorityt value for the given node by 1 and updates it's position within the queue accordingly. |
void |
dispose()
Disposes this queue. |
Node |
getMin()
Returns the node with the minimal value in the queue. |
int |
getPriority(Node v)
Returns the current priority of the given node. |
void |
increasePriority(Node v,
int value)
Increases the priority of a node in the queue to a certain value. |
void |
incrementPriority(Node v)
Increments the associated priority value for the given node by 1 and updates it's position within the queue accordingly. |
boolean |
isEmpty()
Whether or not this queue is empty. |
Node |
popMaxNode()
Returns a node with highest associated int key within this queue. the returned node will be removed from the queue by this method. |
Node |
popMinNode()
Returns a node with smallest associated int key within this queue. the returned node will be removed from the queue by this method. |
void |
remove(Node v)
Removes a node from the queue. |
Node |
removeMin()
Same as popMinNode. |
int |
size()
Returns the number of nodes still in the queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ListIntNodePQ(Graph graph)
public ListIntNodePQ(Graph graph, DataProvider intData, int minValue, int maxValue)
the given data provider has to provide for each defined node
an int value that is not bigger than minValue
and
not smaller than maxValue
Complexity:: O(nc.size()+(maxValue-minValue))
public ListIntNodePQ(Graph graph, DataProvider intData, int minValue, int maxValue, DataProvider wantedNodes)
ListIntNodePQ.ListIntNodePQ(Graph,DataProvider,int,int)
.
Additionally a data provider
can be specified, that holds boolean values for each node in the
graph. Only nodes for which the data provider returns true
will be entered in the queue.
Method Detail |
public void dispose()
dispose
in interface IntNodePQ
public boolean isEmpty()
isEmpty
in interface IntNodePQ
public boolean contains(Node v)
Complexity: O(1)
contains
in interface IntNodePQ
public int size()
public void add(Node v, int value)
add
in interface IntNodePQ
public void decreasePriority(Node v, int value)
decreasePriority
in interface IntNodePQ
v
- a node in the priotity queue.value
- the new priority value of the node.public int getPriority(Node v)
IntNodePQ
getPriority
in interface IntNodePQ
public void increasePriority(Node v, int value)
v
- a node in the priotity queue.value
- the new priority value of the node.public Node getMin()
Precondition: !isEmpty()
Complexity: Amortized O(1)
getMin
in interface IntNodePQ
public void clear()
clear
in interface IntNodePQ
public void remove(Node v)
Complexity: O(1)
public Node removeMin()
removeMin
in interface IntNodePQ
public Node popMinNode()
Precondition: !isEmpty()
Complexity: Amortized O(1)
public Node popMaxNode()
Precondition: !isEmpty()
Complexity: Amortized O(1)
public void incrementPriority(Node v)
Precondition: contains(v)
Complexity: O(1)
public void decrementPriority(Node v)
Precondition: contains(v)
Complexity: O(1)
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |