Bridges-Python  3.4.3
Bridges(Python API)
Public Member Functions | List of all members
bridges.avl_tree_element.AVLTreeElement Class Reference
Inheritance diagram for bridges.avl_tree_element.AVLTreeElement:
bridges.bst_element.BSTElement bridges.bin_tree_element.BinTreeElement bridges.tree_element.TreeElement bridges.element.Element

Detailed Description

This class extends the BSTElement class by adding a height and balance factor fields that are useful in AVL trees.

AVL tree elements include a 'height' and a 'balFactor' value, representing the height and balance factor of the AVL tree at that node, respectively. This is useful in representing AVL trees.

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

AVLTree 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, 6/09/19

Example tutorial using AVLTreeElement at: https://bridgesuncc.github.io/tutorials/AVL.html

Public Member Functions

None __init__ (self, *args, **kwargs)
 AVL Tree constructor. More...
 
str get_data_structure_type (self)
 Get the data structure type. More...
 
str key (self)
 Getter for the search keys. More...
 
int height (self)
 Getter for height of the avl tree at this node. More...
 
None height (self, int value)
 Setter function for the height of the avl tree. More...
 
int balance_factor (self)
 Getter for the balance factor of the tree at this node. More...
 
None balance_factor (self, int value)
 Setter for the balance factor of the tree at this node. More...
 
def left (self)
 Getter for the left child of the avl tree. More...
 
None left (self, val)
 Setter for the left child of the avl tree. More...
 
def right (self)
 Getter for the right child of the avl tree. More...
 
None right (self, val)
 Setter for the right child of the avl tree. More...
 
dict get_element_representation (self)
 Augment the element with the "height" and "balance factor" fields. More...
 
- Public Member Functions inherited from bridges.bst_element.BSTElement
None __init__ (self, **kwargs)
 Constructor bst element. More...
 
None key (self, str k)
 Setter for the bst element key. More...
 
- Public Member Functions inherited from bridges.tree_element.TreeElement
None add_child (self, child)
 Adds a child to this parent node. More...
 
int get_number_of_children (self)
 Get the number of children at this node. More...
 
None set_child (self, int index, child)
 Adds a child to the node that will be added at the next open position. More...
 
def get_child (self, int index)
 Gets a child at particular index. More...
 
dict get_data_structure_representation (self)
 Get the hierarchical JSON of the tree representation (internal use only) More...
 
- Public Member Functions inherited from bridges.element.Element
object value (self)
 Getter for the value this element is holding. More...
 
None value (self, val)
 Setter for the value of an element. More...
 
str identifier (self)
 Getter for the element identifier. More...
 
None identifier (self, int id)
 Setter for the element identifier. More...
 
ElementVisualizer visualizer (self)
 Getter for the element visualizer. More...
 
None visualizer (self, ElementVisualizer vis)
 Setter function for this element visualizer. More...
 
LinkVisualizer get_link_visualizer (self, el)
 
None set_link_visualizer (self, el)
 Setter for the link visualizer of this element. More...
 
None remove_link_visualizer (self, el)
 Deleter function for the lik visualizer of this element. More...
 
def label (self)
 Getter for the element's label. More...
 
def label (self, label)
 Setter for the element's label. More...
 
def size (self)
 Getter for the element's size. More...
 
def size (self, sz)
 Setter for the element's size. More...
 
def color (self)
 Getter for the element's color. More...
 
def color (self, col)
 Setter for the element's size. More...
 
def opacity (self)
 Getter for the element's opacity. More...
 
def opacity (self, op)
 Setter for the element's opacity. More...
 
def shape (self)
 Getter for the element's shape type. More...
 
def shape (self, shp)
 Setter for the element's shape. More...
 
int id (self)
 Get numer of ids of element object. More...
 
def set_location (self, locX, locY)
 Setter for the element's location. More...
 
def get_locationX (self)
 Getter for the element's location in X. More...
 
def get_locationY (self)
 Getter for the element's location in Y. More...
 
def get_link_representation (self, lv, src, dest)
 Getter for the JSON representation of the element's link (for internal use) More...
 

Additional Inherited Members

- Public Attributes inherited from bridges.tree_element.TreeElement
 children
 
- Public Attributes inherited from bridges.element.Element
 color
 
 opacity
 
- Static Public Attributes inherited from bridges.tree_element.TreeElement
string QUOTE = "\""
 
string COMMA = ","
 
string COLON = ":"
 
string OPEN_CURLY = "{"
 
string CLOSE_CURLY = "}"
 
string OPEN_PAREN = "("
 
string CLOSE_PAREN = ")"
 
string OPEN_BOX = "["
 
string CLOSE_BOX = "]"
 
- Static Public Attributes inherited from bridges.element.Element
int ids = 0
 

Constructor & Destructor Documentation

◆ __init__()

None bridges.avl_tree_element.AVLTreeElement.__init__ (   self,
args,
**  kwargs 
)

AVL Tree constructor.

Parameters
key
element
keythe search key
ethe the specific object that the element is holding
Returns
None

Member Function Documentation

◆ balance_factor() [1/2]

int bridges.avl_tree_element.AVLTreeElement.balance_factor (   self)

Getter for the balance factor of the tree at this node.

Returns
int representing the balance factor

◆ balance_factor() [2/2]

None bridges.avl_tree_element.AVLTreeElement.balance_factor (   self,
int  value 
)

Setter for the balance factor of the tree at this node.

       (int) value: An integer for the balance factor at this node
Returns
None

◆ get_data_structure_type()

str bridges.avl_tree_element.AVLTreeElement.get_data_structure_type (   self)

Get the data structure type.

Returns
str the type of data structure

Reimplemented from bridges.bst_element.BSTElement.

◆ get_element_representation()

dict bridges.avl_tree_element.AVLTreeElement.get_element_representation (   self)

Augment the element with the "height" and "balance factor" fields.

Returns
dict representing the json of this element

Reimplemented from bridges.bst_element.BSTElement.

◆ height() [1/2]

int bridges.avl_tree_element.AVLTreeElement.height (   self)

Getter for height of the avl tree at this node.

Returns
int the height of the tree

◆ height() [2/2]

None bridges.avl_tree_element.AVLTreeElement.height (   self,
int  value 
)

Setter function for the height of the avl tree.

       (int) value: An integer for the height at this node
Returns
None

◆ key()

str bridges.avl_tree_element.AVLTreeElement.key (   self)

Getter for the search keys.

Returns
str represeting the key

Reimplemented from bridges.bst_element.BSTElement.

◆ left() [1/2]

def bridges.avl_tree_element.AVLTreeElement.left (   self)

Getter for the left child of the avl tree.

Returns
child

Reimplemented from bridges.bst_element.BSTElement.

◆ left() [2/2]

None bridges.avl_tree_element.AVLTreeElement.left (   self,
  val 
)

Setter for the left child of the avl tree.

Parameters
valthe value to be set for the left child to hold
Returns
None

Reimplemented from bridges.bst_element.BSTElement.

◆ right() [1/2]

def bridges.avl_tree_element.AVLTreeElement.right (   self)

Getter for the right child of the avl tree.

Returns
right child of this tree element

Reimplemented from bridges.bst_element.BSTElement.

◆ right() [2/2]

None bridges.avl_tree_element.AVLTreeElement.right (   self,
  val 
)

Setter for the right child of the avl tree.

Parameters
valthe value to be set for the tight child to hold
Returns
None

Reimplemented from bridges.bst_element.BSTElement.


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