Skip to content

Refactor ConnectedComponentsDfs: rename, clean up, add docs#1300

Merged
williamfiset merged 1 commit into
masterfrom
refactor-connected-components-dfs
Mar 17, 2026
Merged

Refactor ConnectedComponentsDfs: rename, clean up, add docs#1300
williamfiset merged 1 commit into
masterfrom
refactor-connected-components-dfs

Conversation

@williamfiset

Copy link
Copy Markdown
Owner

Summary

  • Rename ConnectedComponentsDfsSolverAdjacencyList to ConnectedComponentsDfs for brevity
  • Eliminate visited array by reusing componentIds with -1 sentinel
  • Make component IDs 0-indexed for consistency with the UnionFind variant
  • Add Javadoc with time/space complexity, graph diagram, and componentId(int) method
  • Make solve() private and graph field final
  • Update BUILD and README

Test plan

  • bazel build ...:graphtheory compiles successfully
  • bazel run ...:ConnectedComponentsDfs produces correct output (4 components)
  • Add tests in follow-up

🤖 Generated with Claude Code

- Rename to ConnectedComponentsDfs for brevity
- Eliminate visited array by using componentIds with -1 sentinel
- Make component IDs 0-indexed for consistency with UnionFind variant
- Add Javadoc with complexity, graph diagram, componentId() method
- Make solve() private, graph field final
- Update BUILD and README

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@williamfiset williamfiset merged commit 497ca85 into master Mar 17, 2026
2 checks passed
@williamfiset williamfiset deleted the refactor-connected-components-dfs branch March 17, 2026 00:36
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