Skip to content

feat: add Dinic maximum flow algorithm - #3223

Open
aryan-sapra wants to merge 1 commit into
TheAlgorithms:masterfrom
aryan-sapra:feat/dinic-max-flow
Open

feat: add Dinic maximum flow algorithm#3223
aryan-sapra wants to merge 1 commit into
TheAlgorithms:masterfrom
aryan-sapra:feat/dinic-max-flow

Conversation

@aryan-sapra

Copy link
Copy Markdown

Description of Change

Adds a self-contained implementation of Dinic's maximum-flow algorithm.

The implementation includes:

  • BFS level-graph construction
  • DFS blocking-flow computation
  • Residual and reverse edges
  • int64_t capacities
  • Self-tests for a classic flow network, parallel edges, and an unreachable sink
  • Doxygen documentation and complexity analysis

The worst-case time complexity is O(V²E).

Checklist

  • Added description of change
  • Added file name matches file name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate
  • I acknowledge that all my contributions will be made under the project's license

Notes: Added graph/dinic_max_flow.cpp as a reusable educational implementation of Dinic's maximum-flow algorithm.

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.

1 participant