Class PQ

java.lang.Object
  |
  +--PQ

public class PQ
extends Object

A priority queue for GraphNodes. Priority is based on the cost field for a GraphNode.

See Also:
Queue

Constructor Summary
PQ(int maxN)
          Constructs a PQ with a max maxN amount of GraphNodes.
 
Method Summary
 void PQdec(int key, double cost)
          Decrements the cost of a GraphNode in this PQ.
 GraphNode PQdel(GraphNode gn)
          Deletes specified GraphNode from the PQ.
 GraphNode PQdelmin()
          Deletes the minimum GraphNode from the PQ.
 boolean PQempty()
          Method that tells whether this PQ is empty
 void PQinc(int key, double cost)
          Increments the cost of a GraphNode in this PQ.
 void PQinsert(GraphNode gn)
          Inserts a GraphNode into this PQ
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PQ

public PQ(int maxN)
Constructs a PQ with a max maxN amount of GraphNodes.
Parameters:
maxN - the maximum amount of GraphNodes for the PQ
Method Detail

PQempty

public boolean PQempty()
Method that tells whether this PQ is empty
Returns:
true if empty

PQinsert

public void PQinsert(GraphNode gn)
Inserts a GraphNode into this PQ
Parameters:
k - GraphNode to be inserted
See Also:
PQdel(GraphNode), PQdelmin()

PQdelmin

public GraphNode PQdelmin()
Deletes the minimum GraphNode from the PQ.
Returns:
the minimum GraphNode
See Also:
PQdel(GraphNode), PQinsert(GraphNode)

PQdel

public GraphNode PQdel(GraphNode gn)
Deletes specified GraphNode from the PQ.
Parameters:
gn - the GraphNode to be deleted
Returns:
the deleted GraphNode
See Also:
PQdelmin(), PQinsert(GraphNode)

PQdec

public void PQdec(int key,
                  double cost)
Decrements the cost of a GraphNode in this PQ.
Parameters:
key - the key of the GraphNode to be decremented
cost - the new cost for the GraphNode

PQinc

public void PQinc(int key,
                  double cost)
Increments the cost of a GraphNode in this PQ.
Parameters:
key - the key of the GraphNode to be incremented
cost - the new cost for the GraphNode


Visualization of Graph Algorithms

Author: Paul Simbi
Started by: Kevin Wayne
2002