Print tree structure to see actual layout
(node, level)
| 40 | |
| 41 | |
| 42 | def _print_tree_structure(node, level): |
| 43 | """Print tree structure to see actual layout""" |
| 44 | indent = " " * level |
| 45 | if node.is_leaf(): |
| 46 | print(f"{indent}Leaf: {len(node.keys)} keys = {node.keys}") |
| 47 | else: |
| 48 | print(f"{indent}Branch: {len(node.keys)} keys, {len(node.children)} children") |
| 49 | if len(node.children) == 1: |
| 50 | print(f"{indent}*** SINGLE CHILD DETECTED ***") |
| 51 | for i, child in enumerate(node.children): |
| 52 | print(f"{indent}Child {i}:") |
| 53 | _print_tree_structure(child, level + 1) |
| 54 | |
| 55 | |
| 56 | if __name__ == "__main__": |
no test coverage detected