Back
edmonds-karp (clj)
(source)function
(edmonds-karp successors predecessors capacity source sink)
(edmonds-karp successors predecessors capacity source sink flow)
Computes the maximum flow on a network, using the edmonds-karp algorithm.
Successors is a function that returns the outgoing neighbor
vertices of a vertex. Predecessors is a function that returns the
incoming neighbor vertices for a vertex. Capacity is a function of
two vertices that returns the capacity on the edge between them.
Source and sink are the unique vertices which supply and consume
flow respectively.
Returns a vector [flow value], where flow is an adjacency map that
represents flows between vertices, and value is the quantity of
flow passing from source to sink.