Skip to content

Refactor BFS, remove FastQueue and Recursive duplicates#1296

Merged
williamfiset merged 5 commits intomasterfrom
refactor-bfs-remove-duplicates
Mar 16, 2026
Merged

Refactor BFS, remove FastQueue and Recursive duplicates#1296
williamfiset merged 5 commits intomasterfrom
refactor-bfs-remove-duplicates

Conversation

@williamfiset
Copy link
Copy Markdown
Owner

Summary

  • Remove BreadthFirstSearchAdjacencyListIterativeFastQueue.java — custom IntQueue is redundant with ArrayDeque
  • Remove BreadthFirstSearchRecursive.java — recursive BFS with queue-passing hack, not a true recursive BFS
  • Refactor BreadthFirstSearchAdjacencyListIterative.java — add algorithm docs, make fields final, clean up code style
  • Remove BUILD targets and README entry for deleted files

Test plan

  • bazel test //src/test/java/com/williamfiset/algorithms/graphtheory:BreadthFirstSearchAdjacencyListIterativeTest passes
  • bazel build //src/main/java/com/williamfiset/algorithms/graphtheory:graphtheory passes

🤖 Generated with Claude Code

williamfiset and others added 5 commits March 15, 2026 22:07
Remove BreadthFirstSearchAdjacencyListIterativeFastQueue (custom IntQueue
variant redundant with ArrayDeque) and BreadthFirstSearchRecursive (recursive
BFS with queue-passing hack). Refactor the remaining BFS implementation
with improved docs, final fields, and cleaner code style.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…AdjacencyList

Drop "Iterative" from the class and file name now that the recursive and
fast-queue variants have been removed. Replace the 13-node example with
a simpler 8-node graph including a visual diagram.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
BFS operates on unweighted graphs, so the cost field and weighted edge
helpers are unnecessary. Rename addUnweightedUndirectedEdge to
addUndirectedEdge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use intValue() instead of != to avoid reference comparison failure
for node indices >= 128 (outside Integer cache range).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@williamfiset williamfiset merged commit 7985f28 into master Mar 16, 2026
2 checks passed
@williamfiset williamfiset deleted the refactor-bfs-remove-duplicates branch March 16, 2026 05:45
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