Back

bf-find-augmenting-path (clj)

(source)

function

(bf-find-augmenting-path successors predecessors capacity flow s t)
Finds a shortest path in the flow network along which there remains residual capacity. Successors is a function which, given a vertex, returns the vertices connected by outgoing edges. Predecessors, similarly is a function to get vertices connected by incoming edges. Capacity is a function which takes two vertices and returns the capacity between them. Flow is an adjacency map which contains the current value of network flow. s is the source node, t the sink.

Examples