Skip to content

Conversation

the-yash-rajput
Copy link

@the-yash-rajput the-yash-rajput commented Oct 1, 2025

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 94.73684% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.22%. Comparing base (421ac6d) to head (88f2467).

Files with missing lines Patch % Lines
.../java/com/thealgorithms/graph/TopologicalSort.java 94.73% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6568      +/-   ##
============================================
+ Coverage     75.19%   75.22%   +0.03%     
- Complexity     5614     5625      +11     
============================================
  Files           690      691       +1     
  Lines         19407    19445      +38     
  Branches       3755     3763       +8     
============================================
+ Hits          14593    14628      +35     
- Misses         4247     4250       +3     
  Partials        567      567              

☔ 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.

@alxkm
Copy link
Member

alxkm commented Oct 1, 2025

Looks like this is already in the repository, but in the wrong package it is definitely related to the graph

https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/sorts/TopologicalSort.java

@the-yash-rajput
Copy link
Author

the-yash-rajput commented Oct 1, 2025

@alxkm How would you like to proceed?
Should we merge this PR or replace the previous implementation with the correct location?

@alxkm I think we can include both, as the previous algorithm is not more friendly to graphs.

@alxkm
Copy link
Member

alxkm commented Oct 1, 2025

@siriak, Could you please help clarify our approach here?
The previous implementation follows a more traditional pattern as it operates directly on color values.
The current implementation also good and it has test coverage.

From my perspective, the optimal solution would be to:

Migrate the old implementation here
Make it generic
Clean up the code (e.g., implement specialized exceptions which already presented here)
Maintain test suites for both variants

What are your thoughts on this approach?

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.

3 participants