R/methods_handle.R
, R/ds_heap.R
handle-methods.Rd
Returns a list of handles and values for node elements that have
a specific key. That means for a given key, the reference to the node
(the handle) as well as the value of the node are returned. If one key fits
fits multiple nodes, all of the values and handles are returned. This is
needed in order to uniquely identify a node if, for example,
decrease_key
on a specific node is going to be called.
handle(obj, key, value) # S4 method for heap,vector,missing handle(obj, key) # S4 method for heap,missing,list handle(obj, value) # S4 method for heap,missing,vector handle(obj, value) # S4 method for heap,missing,matrix handle(obj, value)
obj | a heap object |
---|---|
key | a key in the heap |
value | a value in the heap |
returns extracted handles and values from obj
# returns the handle of a heap f_heap <- fibonacci_heap("integer") f_heap <- insert(f_heap, 1:5, letters[1:5]) handle(f_heap, key=3L)#> [[1]] #> [[1]]$handle #> [1] "handle-2" #> #> [[1]]$value #> [1] "c" #> #>handle(f_heap, value=letters[3])#> [[1]] #> [[1]]$handle #> [1] "handle-2" #> #> [[1]]$key #> [1] 3 #> #>