Skip to content

AVLTree

mstern98 edited this page Mar 25, 2021 · 2 revisions

AVLTree

AVLTree()

Create AVLTree

>>> avl = topylogic.AVLTree()

Insert an element

>>> avl.insert(element, id)

Remove an element by it's id (Use VERTEX_TYPE or EDGE_TYPE for vertex and edge)

>>> removed_element = avl.remove_ID(id, dtype=topylogic.NONE_TYPE)

Find an element

>>> element = avl.find(id, dtype=topylogic.NONE_TYPE)

Return the tree inorder

>>> inorder = avl.inorder(dtype=topylogic.NONE_TYPE)

Return the tree preorder

>>> preorder = avl.preorder(dtype=topylogic.NONE_TYPE)

Return the tree inorder

>>> postorder = avl.postorder(dtype=topylogic.NONE_TYPE)

Destroy the tree and return a stack

>>> s = avl.stackify(dtype=topylogic.NONE_TYPE)

Destroy the tree

>>> avl.destroy()
Clone this wiki locally