Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #29134: node_number_at_depth broken for binary trees
{{{ sage: ascii_art(BinaryTrees(3).list()) [ o , o , o , o, o ] [ \ \ / \ / / ] [ o o o o o o ] [ \ / \ / ] [ o o o o ] sage: [t.node_number_at_depth(0) for t in BinaryTrees(3)] # correct [1, 1, 1, 1, 1] sage: [t.node_number_at_depth(1) for t in BinaryTrees(3)] # expected [1, 1, 2, 1, 1] [2, 2, 2, 2, 2] sage: [t.node_number_at_depth(2) for t in BinaryTrees(3)] # expected [1, 1, 0, 1, 1] [2, 2, 4, 2, 2] }}} This comes from the fact that the empty tree thinks it has 1 node at depth 0: {{{ sage: T = BinaryTree() sage: T . sage: T.is_empty() True sage: T.node_number_at_depth(0) 1 }}} URL: https://trac.sagemath.org/29134 Reported by: gh-mwageringel Ticket author(s): Travis Scrimshaw Reviewer(s): Markus Wageringel
- Loading branch information