Browse Source

TreeLib: fix print_tree

export_seznamu_prednasek
Pavel 'LEdoian' Turinsky 4 years ago
parent
commit
98bad2099a
  1. 4
      seminar/treelib.py

4
seminar/treelib.py

@ -5,9 +5,9 @@ def print_tree(node,indent=0):
# FIXME: Tady se spoléháme na to, že nedeklarovaný primární klíč se jmenuje by default 'id', což není úplně správně
print("{}{} (id: {})".format(" "*indent,node, node.id))
if node.first_child:
node.first_child.print_tree(indent=indent+2)
print_tree(node.first_child, indent=indent+2)
if node.succ:
node.succ.print_tree(indent=indent)
print_tree(node.succ, indent=indent)
## Rodinné vztahy
def get_parent(node):

Loading…
Cancel
Save