feat(graph): add Push–Relabel max flow with tests and index #6793
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.