Skip to content

Add BellmanFord tests for unreachable node relaxation#1250

Merged
williamfiset merged 3 commits intomasterfrom
add-bellmanford-tests
Mar 5, 2026
Merged

Add BellmanFord tests for unreachable node relaxation#1250
williamfiset merged 3 commits intomasterfrom
add-bellmanford-tests

Conversation

@williamfiset
Copy link
Owner

Summary

  • Adds BellmanFordAdjacencyListTest with 3 tests covering the unreachable node relaxation edge case
  • Registers the test target in the graphtheory BUILD file

Tests added

  • unreachableNodeDoesNotPolluteCostOfReachableNeighbor — an unreachable node with a cheaper edge must not update a reachable neighbour's distance
  • nodeReachableOnlyThroughUnreachableIntermediaryStaysUnreachable — a node only reachable via an unreachable intermediary must remain at +Inf
  • unreachableNegativeCycleDoesNotTaintReachableNode — an unreachable negative cycle must not mark reachable nodes as -Inf during the cycle-detection pass

Test plan

  • bazel test //src/test/java/com/williamfiset/algorithms/graphtheory:BellmanFordAdjacencyListTest — all 3 tests pass

🤖 Generated with Claude Code

williamfiset and others added 3 commits March 4, 2026 17:15
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@williamfiset williamfiset merged commit 2825721 into master Mar 5, 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