Skip to content

Conversation

Lakuleshwari
Copy link

I’m contributing this as part of Hacktoberfest to give back to the open-source community
and improve the repository with a widely used graph algorithm.

This PR adds a clean and well-documented implementation of the Floyd-Warshall algorithm
for computing shortest distances between all pairs of vertices in a weighted graph.

Key features:

  • Handles both positive and negative edge weights (no negative cycles allowed).
  • Time Complexity: O(V^3), Space Complexity: O(V^2).
  • Includes a self-contained Graph class and a main method for demonstration/testing.
  • Fully documented with example usage to help other contributors and learners.
  • Works for graphs with positive and negative edge weights (no negative cycles).
  • Fully documented with usage example and test in main method.
  • Follows repository conventions for package structure and code style.

I hope this addition is helpful and aligns with the project’s goals.
I would be grateful if you could review and accept my PR.
Thank you for your time and consideration!

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.21%. Comparing base (f30d101) to head (ad3c8d0).

Files with missing lines Patch % Lines
...in/java/com/thealgorithms/graph/FloydWarshall.java 0.00% 35 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6769      +/-   ##
============================================
- Coverage     77.33%   77.21%   -0.12%     
  Complexity     6175     6175              
============================================
  Files           721      722       +1     
  Lines         20600    20635      +35     
  Branches       3994     4001       +7     
============================================
+ Hits          15931    15934       +3     
- Misses         4056     4089      +33     
+ Partials        613      612       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vil02
Copy link
Member

vil02 commented Oct 18, 2025

Already implemented in FloydWarshall.java.

@vil02 vil02 closed this Oct 18, 2025
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.

4 participants