Skip to content

Refactor Boruvkas#1298

Merged
williamfiset merged 5 commits into
masterfrom
refactor-boruvkas
Mar 16, 2026
Merged

Refactor Boruvkas#1298
williamfiset merged 5 commits into
masterfrom
refactor-boruvkas

Conversation

@williamfiset

Copy link
Copy Markdown
Owner

Summary

  • Fix integer overflow bug in Edge.compareTo — replaced cost - other.cost with Integer.compare(cost, other.cost)
  • Add class-level Javadoc with algorithm steps and time/space complexity
  • Remove unused connected() and size() methods from internal UnionFind
  • Replace stop flag with clearer merged flag checked after merge loop
  • Fix code style: single-line bodies on new lines, specific imports
  • Simplify main example with array initializer and graph diagram

Test plan

  • bazel test //src/test/java/com/williamfiset/algorithms/graphtheory:BoruvkasTest — all 14 tests pass

🤖 Generated with Claude Code

williamfiset and others added 4 commits March 15, 2026 22:47
Fix integer overflow bug in Edge.compareTo (cost - other.cost) by using
Integer.compare. Add algorithm Javadoc, remove unused UnionFind methods,
and simplify main example.

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 changed the title Refactor Boruvkas: add docs, fix compareTo overflow, clean up Refactor Boruvkas Mar 16, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@williamfiset williamfiset merged commit f829082 into master Mar 16, 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