Learn R Programming

datastructures (version 0.2.9)

handle: Get the handles and values for nodes of a specific key in a heap.

Description

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.

Usage

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)

Arguments

obj

a heap object

key

a key in the heap

value

a value in the heap

Value

returns extracted handles and values from obj

Examples

Run this code
# NOT RUN {
 # 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)

 handle(f_heap, value=letters[3])

# }

Run the code above in your browser using DataLab