Calculate the number of nodes at each depth level. This is implemented iteratively. See :py:meth:`.__str__` for usage example. :returns: dict of depth level to number of nodes :rtype: dict int: int
(self)
| 372 | return container['result'] |
| 373 | |
| 374 | def find_nodes_per_depth(self): |
| 375 | """ |
| 376 | Calculate the number of nodes at each depth level. |
| 377 | |
| 378 | This is implemented iteratively. See :py:meth:`.__str__` for usage example. |
| 379 | |
| 380 | :returns: dict of depth level to number of nodes |
| 381 | :rtype: dict int: int |
| 382 | """ |
| 383 | |
| 384 | nodes_per_depth = {} |
| 385 | self._iter_helper(lambda curr, d=nodes_per_depth: d.update({ (curr.depth, d.get(curr.depth, 0) + 1) })) |
| 386 | return nodes_per_depth |
| 387 | |
| 388 | def sum_entities(self, entities_per_depth=None): |
| 389 | """ |