Returns True if the partition has no children. Args: partition: the BinaryPartition node Returns: A boolean indicating whether partition is a leaf node.
(partition: mp.BinaryPartition)
| 7 | |
| 8 | |
| 9 | def is_leaf_node(partition: mp.BinaryPartition) -> bool: |
| 10 | """Returns True if the partition has no children. |
| 11 | |
| 12 | Args: |
| 13 | partition: the BinaryPartition node |
| 14 | |
| 15 | Returns: |
| 16 | A boolean indicating whether partition is a leaf node. |
| 17 | """ |
| 18 | return partition.left is None and partition.right is None |
| 19 | |
| 20 | |
| 21 | def enumerate_leaf_nodes( |
no outgoing calls
no test coverage detected