|
mxGraph 2.5.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mxgraph.analysis.mxFibonacciHeap
public class mxFibonacciHeap
This class implements a priority queue.
Nested Class Summary | |
---|---|
static class |
mxFibonacciHeap.Node
Implements a node of the Fibonacci heap. |
Field Summary | |
---|---|
protected mxFibonacciHeap.Node |
min
|
protected Map<Object,mxFibonacciHeap.Node> |
nodes
Maps from elements to nodes |
protected int |
size
|
Constructor Summary | |
---|---|
mxFibonacciHeap()
|
Method Summary | |
---|---|
protected void |
cascadingCut(mxFibonacciHeap.Node y)
Performs a cascading cut operation. |
protected void |
consolidate()
Consolidates the trees in the heap by joining trees of equal degree until there are no more trees of equal degree in the root list. |
protected void |
cut(mxFibonacciHeap.Node x,
mxFibonacciHeap.Node y)
The reverse of the link operation: removes x from the child list of y. |
void |
decreaseKey(mxFibonacciHeap.Node x,
double k)
Decreases the key value for a heap node, given the new value to take on. |
void |
delete(mxFibonacciHeap.Node x)
Deletes a node from the heap given the reference to the node. |
mxFibonacciHeap.Node |
getNode(Object element,
boolean create)
Returns the node that represents element. |
void |
insert(mxFibonacciHeap.Node node,
double key)
Inserts a new data element into the heap. |
boolean |
isEmpty()
Returns true if the queue is empty. |
protected void |
link(mxFibonacciHeap.Node y,
mxFibonacciHeap.Node x)
Make node y a child of node x. |
mxFibonacciHeap.Node |
min()
Returns the smallest element in the heap. |
mxFibonacciHeap.Node |
removeMin()
Removes the smallest element from the heap. |
int |
size()
Returns the size of the heap which is measured in the number of elements contained in the heap. |
static mxFibonacciHeap |
union(mxFibonacciHeap h1,
mxFibonacciHeap h2)
Joins two Fibonacci heaps into a new one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<Object,mxFibonacciHeap.Node> nodes
protected mxFibonacciHeap.Node min
protected int size
Constructor Detail |
---|
public mxFibonacciHeap()
Method Detail |
---|
public mxFibonacciHeap.Node getNode(Object element, boolean create)
public boolean isEmpty()
public void decreaseKey(mxFibonacciHeap.Node x, double k)
Running time: O(1) amortized
x
- Node whose value should be decreased.k
- New key value for node x.
IllegalArgumentException
- Thrown if k is larger than x.key value.public void delete(mxFibonacciHeap.Node x)
Running time: O(log n) amortized
x
- The node to remove from the heap.public void insert(mxFibonacciHeap.Node node, double key)
Running time: O(1) actual
node
- new node to insert into heapkey
- key value associated with data objectpublic mxFibonacciHeap.Node min()
Running time: O(1) actual
public mxFibonacciHeap.Node removeMin()
Running time: O(log n) amortized
public int size()
Running time: O(1) actual
public static mxFibonacciHeap union(mxFibonacciHeap h1, mxFibonacciHeap h2)
Running time: O(1) actual
h1
- The first heap.h2
- The second heap.
protected void cascadingCut(mxFibonacciHeap.Node y)
Running time: O(log n); O(1) excluding the recursion
y
- The node to perform cascading cut on.protected void consolidate()
Running time: O(log n) amortized
protected void cut(mxFibonacciHeap.Node x, mxFibonacciHeap.Node y)
Running time: O(1)
x
- The child of y to be removed from y's child list.y
- The parent of x about to lose a child.protected void link(mxFibonacciHeap.Node y, mxFibonacciHeap.Node x)
Running time: O(1) actual
y
- The node to become child.x
- The node to become parent.
|
mxGraph 2.5.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |