Skip to content

feat(tree): ✨ add applyPreOrder and applyPostOrder tree meth…#88

Merged
LeoFeatherstone merged 1 commit intomainfrom
dev
May 18, 2025
Merged

feat(tree): ✨ add applyPreOrder and applyPostOrder tree meth…#88
LeoFeatherstone merged 1 commit intomainfrom
dev

Conversation

@LeoFeatherstone
Copy link
Contributor

No description provided.

@LeoFeatherstone LeoFeatherstone requested a review from Copilot May 18, 2025 08:31
@LeoFeatherstone LeoFeatherstone merged commit 277e656 into main May 18, 2025
2 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds two new convenience methods (applyPreOrder and applyPostOrder) to the Tree class and includes corresponding tests in the test suite.

  • Introduces tree traversal methods in src/tree/tree.ts
  • Adds pre-order and post-order traversal tests in test/tree/tree.spec.ts

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/tree/tree.ts Adds applyPreOrder and applyPostOrder methods with documentation.
test/tree/tree.spec.ts Introduces tests validating pre-order and post-order traversals; also note a spelling mistake in a describe block.
Comments suppressed due to low confidence (1)

test/tree/tree.spec.ts:33

  • The word 'Netowrks' appears to be misspelled. It should be corrected to 'Networks'.
describe('Netowrks', () => {

describe('Traversal', () => {
test('applyPreOrder', () => {
// Create a tree with three tips using Newick: ((A,B),C);
const tree = readNewick('(((A,B),C);');
Copy link

Copilot AI May 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Newick string appears to have unbalanced parentheses. Consider correcting it to '((A,B),C);' as indicated by the comment.

Suggested change
const tree = readNewick('(((A,B),C);');
const tree = readNewick('((A,B),C);');

Copilot uses AI. Check for mistakes.
});
test('applyPostOrder', () => {
// Create a tree with three tips using Newick: ((A,B),C);
const tree = readNewick('(((A,B),C);');
Copy link

Copilot AI May 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Newick string appears to have unbalanced parentheses. Consider correcting it to '((A,B),C);' as indicated by the comment.

Suggested change
const tree = readNewick('(((A,B),C);');
const tree = readNewick('((A,B),C);');

Copilot uses AI. Check for mistakes.
}

/**
* Convenience function applied function pre-order to all nodes in the tree.
Copy link

Copilot AI May 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider rephrasing the comment to 'Convenience function to apply the given function in pre-order to all nodes in the tree.' for better clarity.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

🎉 This PR is included in version 1.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant