Bridges-Python 3.5.1
Bridges(Python API)
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Properties | List of all members
bridges.bst_element.BSTElement Class Reference

The BSTElement class is the building block for creating binary search trees. More...

Inheritance diagram for bridges.bst_element.BSTElement:
bridges.bin_tree_element.BinTreeElement bridges.tree_element.TreeElement bridges.element.Element bridges.avl_tree_element.AVLTreeElement bridges.kd_tree_element.KDTreeElement

Public Member Functions

None __init__ (self, **kwargs)
 Constructor bst element.
 
str get_data_structure_type (self)
 Get the data structure representation.
 
dict get_element_representation (self)
 Augment the element with the "key" field.
 
- Public Member Functions inherited from bridges.tree_element.TreeElement
None add_child (self, child)
 Adds a child to this parent node.
 
int get_number_of_children (self)
 Get the number of children at this node.
 
None set_child (self, int index, child)
 Adds a child to the node that will be added at the next open position.
 
 get_child (self, int index)
 Gets a child at particular index.
 
dict get_data_structure_representation (self)
 Get the hierarchical JSON of the tree representation (internal use only)
 
- Public Member Functions inherited from bridges.element.Element
LinkVisualizer get_link_visualizer (self, el)
 Getter for the link visualizer object that links this element to another element specified by the argument.
 
None set_link_visualizer (self, el)
 Setter for the link visualizer of this element.
 
None remove_link_visualizer (self, el)
 Deleter function for the lik visualizer of this element.
 
 set_location (self, locX, locY)
 Setter for the element's location.
 
 get_locationX (self)
 Getter for the element's location in X.
 
 get_locationY (self)
 Getter for the element's location in Y.
 
 get_link_representation (self, lv, src, dest)
 Getter for the JSON representation of the element's link (for internal use)
 

Protected Attributes

 _key
 
- Protected Attributes inherited from bridges.element.Element
 _link_visualizer
 
 _ids
 
 _identifier
 
 _visualizer
 
 _value
 
 _label
 

Properties

 key = property
 Getter for the bst element key.
 
 left = property
 Getter for the left element in BST.
 
 right = property
 Getter for the right child in BST.
 
- Properties inherited from bridges.bin_tree_element.BinTreeElement
- Properties inherited from bridges.element.Element
 value = property
 Getter for the value this element is holding.
 
 identifier = property
 Getter for the element identifier.
 
 visualizer = property
 Getter for the element visualizer.
 
 label = property
 Getter for the element's label.
 
 size = property
 Getter for the element's size.
 
 color = property
 Getter for the element's color.
 
 opacity = property
 Getter for the element's opacity.
 
 shape = property
 Getter for the element's shape type.
 
 id = property
 Get numer of ids of element object.
 

Additional Inherited Members

- Public Attributes inherited from bridges.tree_element.TreeElement
 children
 
- Static Public Attributes inherited from bridges.tree_element.TreeElement
str QUOTE = "\""
 
str COMMA = ","
 
str COLON = ":"
 
str OPEN_CURLY = "{"
 
str CLOSE_CURLY = "}"
 
str OPEN_PAREN = "("
 
str CLOSE_PAREN = ")"
 
str OPEN_BOX = "["
 
str CLOSE_BOX = "]"
 
- Static Public Attributes inherited from bridges.element.Element
int ids = 0
 
- Protected Member Functions inherited from bridges.tree_element.TreeElement
dict _pre_order (self, root)
 Use a preoreder traversal to directly extract a hierarchical JSON representation of the tree.
 

Detailed Description

The BSTElement class is the building block for creating binary search trees.

The BSTElement class is the building block for creating binary search tree structures. It contains two children (viz., left, right), and a search key, to be used in search operations .

BSTElement contains a visualizer (ElementVisualizer) object for setting visual attributes (color, shape, opacity, size), necessary for displaying them in a web browser.

BST Elements also have a LinkVisualizer object, that is used when they are linked to another element, appropriate for setting link attributes, for instance, between the current element and its left or right child

Author
Kalpathi Subramanian, Mihai Mehedint, Matthew McQuaigue
Date
6/22/16, 1/7/17, 5/17/17, 7/23/19, 2021

This class extends the BinTreeElement class by adding a 'key' value for use in a binary search tree implementations.

Binary Search Tree tutorial, https://bridgesuncc.github.io/tutorials/BinarySearchTree.html

Constructor & Destructor Documentation

◆ __init__()

None bridges.bst_element.BSTElement.__init__ (   self,
**  kwargs 
)

Constructor bst element.

       (str) key: The label for the tree element that shows in visualization
       (generic) e: the generic object that the tree element will hold
       (BinTreeElement) left: the tree element assigned to child 0
       (BinTreeElement) right: the tree element assigned to child 1
Returns
None

Reimplemented from bridges.bin_tree_element.BinTreeElement.

Reimplemented in bridges.kd_tree_element.KDTreeElement, and bridges.avl_tree_element.AVLTreeElement.

Member Function Documentation

◆ get_data_structure_type()

str bridges.bst_element.BSTElement.get_data_structure_type (   self)

Get the data structure representation.

Returns
str

Reimplemented from bridges.bin_tree_element.BinTreeElement.

Reimplemented in bridges.avl_tree_element.AVLTreeElement, and bridges.kd_tree_element.KDTreeElement.

◆ get_element_representation()

dict bridges.bst_element.BSTElement.get_element_representation (   self)

Augment the element with the "key" field.

Returns
dict representing the json of this tree

Reimplemented from bridges.element.Element.

Reimplemented in bridges.avl_tree_element.AVLTreeElement, and bridges.kd_tree_element.KDTreeElement.

Member Data Documentation

◆ _key

bridges.bst_element.BSTElement._key
protected

Property Documentation

◆ key

bridges.bst_element.BSTElement.key = property
static

Getter for the bst element key.

Returns
str the key label

◆ left

bridges.bst_element.BSTElement.left = property
static

Getter for the left element in BST.

Returns
BSTElement the left child of this element

◆ right

bridges.bst_element.BSTElement.right = property
static

Getter for the right child in BST.

Returns
BSTElement the right child of the element

The documentation for this class was generated from the following file: