|
|
@ -11,13 +11,16 @@ def print_tree(node,indent=0): |
|
|
|
|
|
|
|
## Rodinné vztahy |
|
|
|
def get_parent(node): |
|
|
|
pass |
|
|
|
# Nejdřív získáme prvního potomka... |
|
|
|
|
|
|
|
# ... a z prvního potomka umíme najít rodiče |
|
|
|
|
|
|
|
# Obecný next: další Node v "the-right-order" pořadí (já, pak potomci, pak sousedé) |
|
|
|
def general_next(node) |
|
|
|
def general_prev(node) |
|
|
|
def general_next(node): |
|
|
|
pass |
|
|
|
def general_prev(node): |
|
|
|
pass |
|
|
|
|
|
|
|
# Generátor potomků |
|
|
|
# TODO: copy-pasta |
|
|
@ -30,32 +33,44 @@ def general_prev(node) |
|
|
|
# Najdi dalšího bratra nějakého typu, nebo None. |
|
|
|
# hledá i podtřídy, i.e. get_next_brother_of_type(neco, TreeNode) je prostě succ. |
|
|
|
def get_next_brother_of_type(current, type): |
|
|
|
pass |
|
|
|
def get_prev_brother_of_type(current, type): |
|
|
|
pass |
|
|
|
|
|
|
|
# Totéž pro "the-right-order" pořadí |
|
|
|
def get_next_node_of_type(current, type): |
|
|
|
pass |
|
|
|
def get_next_node_of_type(current, type): |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Editace stromu: |
|
|
|
def create_node_after(predecessor, type, **kwargs): |
|
|
|
pass |
|
|
|
|
|
|
|
# Vyrábí prvního syna, ostatní nalepí za (existují-li) |
|
|
|
def create_child(parent, type, **kwargs): |
|
|
|
pass |
|
|
|
|
|
|
|
def create_node_before(...): |
|
|
|
def create_node_before(some, arguments, but, i, dont, know, which, yet): |
|
|
|
pass |
|
|
|
# Tohle bude hell. |
|
|
|
|
|
|
|
# ValueError, pokud je (aspoň) jeden parametr None |
|
|
|
def swap(node, other): |
|
|
|
pass |
|
|
|
|
|
|
|
def swap_pred |
|
|
|
def swap_succ |
|
|
|
def swap_pred(node): |
|
|
|
pass |
|
|
|
def swap_succ(node): |
|
|
|
pass |
|
|
|
|
|
|
|
# Rotace stromu |
|
|
|
# Dokumentace viz wiki: |
|
|
|
# (lower bude jednoduchá rotace, ne mega, existence jednoduché rotace mi došla až po nakreslení obrázku) |
|
|
|
def raise(node) |
|
|
|
def lower(node) |
|
|
|
def raise_node(node): |
|
|
|
pass |
|
|
|
def lower_node(node): |
|
|
|
pass |
|
|
|