You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @description Compute the maximum flow from a source node to a sink node. The input graph is in adjacency list form. It is a multidimensional array of edges. graph[i] holds the edges for the i'th node. Each edge is a 3-tuple where the 0'th item is the destination node, the 1'th item is the edge weight, and the 2'nd item is the edge capacity.
2
+
* @function edmondkarp
3
+
* @description Compute the maximum flow from a source node to a sink node. The input graph is in adjacency list form. It is a multidimensional array of edges. graph[i] holds the edges for the i'th node. Each edge is a 2-tuple where the 0'th item is the destination node, and the 1'st item is the edge capacity.
3
4
* @Complexity_Analysis
4
-
* Time complexity: O(V*E^2) where V is the number of vertices and E is the number of edges
5
-
* Space Complexity: O(V) where V is the number of vertices
6
-
* @param {[number, number, number][][]} graph - The graph in adjacency list form
5
+
* Time complexity: O(V * E^2) where V is the number of vertices and E is the number of edges
6
+
* Space Complexity: O(V^2) where V is the number of vertices
7
+
* @param {[number, number][][]} graph - The graph in adjacency list form
7
8
* @param {number} source - The source node
8
9
* @param {number} sink - The sink node
9
10
* @return {number} - The maximum flow from the source node to the sink node
0 commit comments