Kumar-laxmi / Algorithms

A Repository for algorithms in C, C++, Python and Java
Apache License 2.0
326 stars 367 forks source link

Ford-Fulkerson Algorithm #1510

Closed Devchawla2608 closed 1 year ago

Devchawla2608 commented 1 year ago

Is your feature request related to a problem? Please describe. Ford-Fulkerson is a graph algorithm used to find the maximum flow in a flow network. It iteratively finds augmenting paths from the source to the sink and updates the flow along those paths until no more augmenting paths exist.

Describe the solution you'd like 1.) Start with an initial flow of 0. 2.) While there is a path from the source to the sink in the residual graph: 3.) Find an augmenting path in the residual graph. An augmenting path is a path from the source to the sink such that all edges in the path have residual capacity greater than 0. 4.) Determine the minimum residual capacity along the augmenting path. This is the maximum amount of flow that can be added to the current flow. 5.) Augment the flow along the augmenting path by the minimum residual capacity. 6.) Update the residual capacities of the edges in the augmenting path. Return the maximum flow.

Additional context image

Devchawla2608 commented 1 year ago

@Kumar-laxmi please assign this to me under SSOC'23. I'm ready to contribute in all 4 languages

Kumar-laxmi commented 1 year ago

Assigned! @Devchawla2608 : C & Java

udc29h commented 1 year ago

Please assign this to me under SSOC'23. I can easily implement it in all the languages.