MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / _calculate_tree_depth

Method _calculate_tree_depth

python/tests/fuzz_test.py:122–132  ·  view source on GitHub ↗

Calculate the depth of the tree

(self)

Source from the content-addressed store, hash-verified

120 random.setstate(prepop_state)
121
122 def _calculate_tree_depth(self) -> int:
123 """Calculate the depth of the tree"""
124
125 def get_depth(node, current_depth=0):
126 if node.is_leaf():
127 return current_depth
128 if not node.children:
129 return current_depth
130 return max(get_depth(child, current_depth + 1) for child in node.children)
131
132 return get_depth(self.btree.root)
133
134 def verify_consistency(self) -> bool:
135 """Verify that B+ tree matches reference implementation"""

Callers 1

_prepopulate_treeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected