Bases: object
A basic binary search tree in pure Python, used as an engine for indexing.
Parameters: | data : Table
row_index : Column object
unique : bool (defaults to False)
|
---|
Attributes Summary
height | Return the BST height. |
Methods Summary
add(key[, data]) | Add a key, data pair. |
find(key) | Return all data values corresponding to a given key. |
find_node(key) | Find the node associated with the given key. |
is_valid() | Returns whether this is a valid BST. |
items() | Return BST items in order as (key, data) pairs. |
range(lower, upper[, bounds]) | Return all nodes with keys in the given range. |
range_nodes(lower, upper[, bounds]) | Return nodes in the given range. |
remove(key[, data]) | Remove data corresponding to the given key. |
replace_rows(row_map) | Replace all rows with the values they map to in the given dictionary. |
same_prefix(val) | Assuming the given value has smaller length than keys, return nodes whose keys have this value as a prefix. |
shift_left(row) | Decrement all rows larger than the given row. |
shift_right(row) | Increment all rows greater than or equal to the given row. |
sort() | Make row order align with key order. |
sorted_data() | Return BST rows sorted by key values. |
traverse([order]) | Return nodes of the BST in the given order. |
Attributes Documentation
Return the BST height.
Methods Documentation
Add a key, data pair.
Return all data values corresponding to a given key.
Parameters: | key : tuple
|
---|---|
Returns: | data_vals : list
|
Find the node associated with the given key.
Returns whether this is a valid BST.
Return BST items in order as (key, data) pairs.
Return all nodes with keys in the given range.
Parameters: | lower : tuple
upper : tuple
bounds : tuple (x, y) of bools
|
---|
Return nodes in the given range.
Remove data corresponding to the given key.
Parameters: | key : tuple
data : int or None
|
---|---|
Returns: | successful : bool
|
Replace all rows with the values they map to in the given dictionary. Any rows not present as keys in the dictionary will have their nodes deleted.
Parameters: | row_map : dict
|
---|
Assuming the given value has smaller length than keys, return nodes whose keys have this value as a prefix.
Decrement all rows larger than the given row.
Increment all rows greater than or equal to the given row.
Make row order align with key order.
Return BST rows sorted by key values.
Return nodes of the BST in the given order.
Parameters: | order : str
|
---|