feat(graph): add Push–Relabel max flow with tests and index#6793
Merged
alxkm merged 4 commits intoTheAlgorithms:masterfrom Oct 15, 2025
Merged
feat(graph): add Push–Relabel max flow with tests and index#6793alxkm merged 4 commits intoTheAlgorithms:masterfrom
alxkm merged 4 commits intoTheAlgorithms:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6793 +/- ##
============================================
+ Coverage 77.78% 77.81% +0.03%
- Complexity 6307 6331 +24
============================================
Files 728 729 +1
Lines 21012 21091 +79
Branches 4097 4117 +20
============================================
+ Hits 16345 16413 +68
- Misses 4022 4027 +5
- Partials 645 651 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
alxkm
approved these changes
Oct 15, 2025
Member
alxkm
left a comment
There was a problem hiding this comment.
Looks good. Thank you for the contribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Push–Relabel (Relabel-to-Front variant) max-flow with tests and reference
Summary
EdmondsKarp, Dinic), enabling parity checks and providing an alternative approach with strong practical performance.Changes
excess[sink]as the max flow.source == sink(0).EdmondsKarpon random small graphs.graph/.API
capacity[u][v] >= 0, indices within[0, n).int.0whensource == sink.Algorithm details
sourceto neighbors; setheight[source] = n.height[u] == height[v] + 1); otherwise relabel(u).vgains positive excess (andvis neithersourcenorsink), enqueue it.Tests
23for classic network.EdmondsKarpon random small graphs.References
https://en.wikipedia.org/wiki/Push%E2%80%93relabel_maximum_flow_algorithm
Verification
mvn verifypasses locally (tests + Checkstyle + PMD + SpotBugs).clang-format(--style=file).Checklist
clang-format) andmvn verifypasses locally.Issue linkage
Notes for reviewers
EdmondsKarp.Summary
Adds a complete, tested Push–Relabel max-flow implementation with documentation and references, consistent with existing APIs. Ready for review and merge.