MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / insert

Method insert

JSAT/src/jsat/utils/FibHeap.java:57–82  ·  view source on GitHub ↗
(T value, double weight)

Source from the content-addressed store, hash-verified

55 }
56
57 public FibNode<T> insert(T value, double weight)
58 {
59 //FIB-HEAP-INSERT
60 @SuppressWarnings("unchecked")
61 FibNode<T> x = new FibNode(value, weight);
62 x.p = null;
63 x.child = null;
64
65 if(min == null)
66 {
67 //6| create a root list for H containing just x
68// H = new ArrayList<FibNode<T>>();
69// H.add(x);
70 //7| H.min D x
71 min = x;
72 }
73 else
74 {
75 //8| insert x into H ’s root list
76 min = merge(min, x);//9 & 10 handled implicitly by the behavior of merge method
77 }
78 //11| H.n = H.n+1
79 this.n++;
80
81 return x;
82 }
83
84 public static <T> FibHeap<T> union(FibHeap<T> A, FibHeap<T> B)
85 {

Callers 6

testDecreaseKeyMethod · 0.95
testUnionMethod · 0.95
testGetMinKeyMethod · 0.95
testRandomMethod · 0.95
clusterMethod · 0.95
dijkstraMethod · 0.95

Calls 1

mergeMethod · 0.95

Tested by 4

testDecreaseKeyMethod · 0.76
testUnionMethod · 0.76
testGetMinKeyMethod · 0.76
testRandomMethod · 0.76