Skip to content

Refactor TreeCenter: simplify algorithm, add docs and tests#1291

Merged
williamfiset merged 4 commits into
masterfrom
refactor-tree-center
Mar 13, 2026
Merged

Refactor TreeCenter: simplify algorithm, add docs and tests#1291
williamfiset merged 4 commits into
masterfrom
refactor-tree-center

Conversation

@williamfiset

Copy link
Copy Markdown
Owner

Summary

  • Added class-level Javadoc with algorithm description ("peeling leaf layers"), O(V+E) / O(V) complexity
  • Simplified findTreeCenters() — removed intermediate variables and redundant degree[node] = 0
  • Removed @author Modifications by line
  • Replaced LinkedList with ArrayList, cleaned up imports
  • Trimmed main to one significant example with ASCII diagram
  • Added starGraph() and asymmetricTree() tests to test file
  • Cleaned up wildcard imports in test file

Test plan

  • All 9 TreeCenterTest tests pass (including randomized cross-impl check)

🤖 Generated with Claude Code

williamfiset and others added 4 commits March 12, 2026 18:26
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@williamfiset williamfiset merged commit 20b7e29 into master Mar 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant