User:Jmgibson3312/EdmondsKarp pseudo code using Adjacency nodes

Pseudocode

 * ''EdmondsKarp pseudo code using Adjacency nodes.

algorithm EdmondsKarp input: graph (Graph with list of Adjacency nodes with capacities,flow,reverse and destinations) s            (Source) t            (Sink) output: flow            (Value of maximum flow) flow := 0 (Initial flow to zero) q := array(1..n) (Initialize q to graph length) while true qt := 0		(Variable to iterate over all the corresponding edges for a source) q[qt+1] := s   (initialize source array) pred := array(q.length)   (Initialize predecessor List with the graph length) for qh=0;qh < qt && pred[t] := null cur := q[qh] for (graph[cur]) (Iterate over list of Edges) Edge[] e := graph[cur]  (Each edge should be associated with Capacity) if pred[e.t] == null && e.cap > e.f                    pred[e.t] := e                     q[qt++] : = e.t         if pred[t] = null break int df := MAX VALUE (Initialize to max integer value) for u = t; u != s; u = pred[u].s            df := min(df, pred[u].cap - pred[u].f)         for u = t; u != s; u = pred[u].s              pred[u].f  := pred[u].f + df             pEdge := array(PredEdge) pEdge := graph[pred[u].t]            pEdge[pred[u].rev].f := pEdge[pred[u].rev].f - df; flow := flow + df    return flow