Skip to content

Add DFS with parent-completion constraint for DAG traversal #6467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

StathisVeinoglou
Copy link
Contributor

Description

This PR adds a new GraphTraversal class that implements a modified DFS traversal order for directed graphs, ensuring that a node is only visited if all its parents have already been visited.
This approach is useful in dependency resolution and neural network computation graph execution order.

  • 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 Aug 14, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.12%. Comparing base (16345cb) to head (ec54953).

Files with missing lines Patch % Lines
...thealgorithms/graph/PredecessorConstrainedDfs.java 77.77% 6 Missing and 6 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6467      +/-   ##
============================================
+ Coverage     75.10%   75.12%   +0.02%     
- Complexity     5556     5575      +19     
============================================
  Files           686      687       +1     
  Lines         19264    19318      +54     
  Branches       3719     3732      +13     
============================================
+ Hits          14468    14513      +45     
- Misses         4239     4244       +5     
- Partials        557      561       +4     

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

@StathisVeinoglou StathisVeinoglou marked this pull request as ready for review August 14, 2025 09:26
…raightforward about the implementation.Added full names instead of shortcuts, and included record.
@StathisVeinoglou
Copy link
Contributor Author

Thanks for all the suggestions! I believe that i implemented the changes.
Please let me know if anything further is needed

@DenizAltunkapan DenizAltunkapan enabled auto-merge (squash) August 15, 2025 16:39
@DenizAltunkapan DenizAltunkapan merged commit 2dd6a13 into TheAlgorithms:master Aug 15, 2025
6 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.

4 participants