Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor areCausallyRelatedUsingBFS to Use BFS Correctly and Remove Duplicated Code #204

Closed
trungnotchung opened this issue Oct 28, 2024 · 0 comments
Assignees

Comments

@trungnotchung
Copy link
Contributor

The areCausallyRelatedUsingBFS function incorrectly uses DFS instead of BFS by employing a stack.

Additionally, it duplicates traversal logic when checking for causality in both directions (hash1 -> hash2 and hash2 -> hash1). This function should be refactored to use a queue for BFS and to separate the traversal logic into a reusable helper function to improve readability and maintainability.

File: packages/object/src/hashgraph/index.ts

@trungnotchung trungnotchung self-assigned this Oct 28, 2024
trungnotchung added a commit that referenced this issue Oct 28, 2024
trungnotchung added a commit that referenced this issue Oct 28, 2024
trungnotchung added a commit that referenced this issue Oct 28, 2024
trungnotchung added a commit that referenced this issue Oct 28, 2024
d-roak added a commit that referenced this issue Oct 28, 2024
@d-roak d-roak closed this as completed Oct 28, 2024
@github-project-automation github-project-automation bot moved this from Triage to 🏆 Done in Project Management Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants