Cover image for Basics of Ford-Fulkerson Algorithm

Basics of Ford-Fulkerson Algorithm

asrivastavacoder profile image asrivastava-coder ・3 min read

If a graph is given which speaks to a stream network where each edge has a limit. Additionally given two vertices source 's' and sink 't' in the diagram, locate the greatest conceivable stream from s to t with following limitations:

a) Flow on an edge doesn't surpass the given limit of the edge.

b) Incoming stream is equivalent to active stream for each vertex aside from s and t.

Time Complexity: Time intricacy of the above calculation is O(max_flow * E). We run a circle while there is an expanding way. In most pessimistic scenario, we may include 1 unit stream in each emphasis. Consequently the time multifaceted nature becomes O(max_flow * E).

How to execute the above straightforward calculation?

Let us initially characterize the idea of Residual Graph which is required for understanding the usage.

Leftover Graph of a stream network is a diagram which shows extra conceivable stream. On the off chance that there is a way from source to soak in remaining diagram, at that point it is conceivable to include stream. Each edge of a leftover diagram has a worth called lingering limit which is equivalent to unique limit of the edge short current stream. Remaining limit is essentially the current limit of the edge.

Let us currently talk about execution subtleties. Remaining limit is 0 if there is no edge between two vertices of lingering chart. We can instate the leftover diagram as unique chart as there is no underlying stream and at first lingering limit is equivalent to unique limit. To discover an expanding way, we can either do a BFS or DFS of the lingering chart. We have utilized BFS in underneath execution. Utilizing BFS, we can see whether there is a way from source to sink. BFS likewise fabricates parent[] cluster. Utilizing the parent[] exhibit, we cross through the discovered way and discover conceivable move through this way by discovering least leftover limit along the way. We later add the discovered way stream to in general stream.

The significant thing is, we have to refresh remaining limits in the lingering chart. We deduct way stream from all edges along the way and we include way stream along the opposite edges We have to include way stream along invert edges in light of the fact that may later need to send stream backward heading.

The Ford-Fulkerson calculation is a calculation that handles the maximum stream min-cut issue. That is, given an organization with vertices and edges between those vertices that have certain loads, what amount "stream" can the organization cycle at once? Stream can mean anything, yet regularly it implies information through a PC organization.

It was found in 1956 by Ford and Fulkerson. This calculation is here and there alluded to as a technique since parts of its convention are not completely determined and can shift from execution to usage. A calculation ordinarily alludes to a particular convention for taking care of an issue, while a strategy is a more broad way to deal with an issue.

The Ford-Fulkerson calculation accept that the info will be a diagram, GG, alongside a source vertex, ss, and a sink vertex, tt. The chart is any portrayal of a weighted diagram where vertices are associated by edges of indicated loads. There must likewise be a source vertex and sink vertex to comprehend the start and end of the stream organization.

Passage Fulkerson has an intricacy of O\big(|E| \cdot f^{*}\big),O(∣E∣⋅f

), where f^{*}f

is the greatest progression of the organization. The Ford-Fulkerson calculation was in the end developed by the Edmonds-Karp calculation, which does likewise in O\big(V^2 \cdot E\big)O(V


⋅E) time, free of the greatest stream esteem.


Editor guide