n-dimensional network flow solver
Network flow in the nth-dimension!
First install like this:
npm install ndflow
Then use it as follows:
012 123 //Simplicial complex1 1 //Capacities01 13 32 20 //Boundary circulation1111 //Boundary weights11 //Cost function
Solves for the flow from the boundary cells that minimizes the cost. This is the same thing as solving the linear program:
Minimize cost(flow)Subject to D(flow) = boundary_cells * boundary_weights0 <= flow <= capacities
In the case where the cell complex is one dimensional, this is the same as solving minimum cost network flow for a given capacity. Binary searching on the scale of the capacities lets one compute a maximum/min-cost flow.
(c) 2013 Mikola Lysenko. BSD License