% vgg_graph_maxflow  Solving maximum flow (minimum cut) graph problem.
%   Type vgg_graph_maxflow_demo for demo!
%
% [cut,flow] = vgg_graph_maxflow(STE,E_n,E_w) solves maximum flow (minimum cut)
% problem in an oriented valued graph with one source and one sink.
%
% Parameters:
%   int16  STE(2,N) ... STE(:,n) are weights of edges from source to node n
%     and from node n to sink, respectively
%   uint32 E_n(2,:) ... E_n(:,e) are indices of start and end node of edge e, respectively.
%     Indices of nodes are 1:N.
%   int16  E_w(2,:) ... E_w(:,e) is forward and backward weight of edge e
%   cut ... uint8(N), cut(n) is 0 or 1 for node n assigned to source or sink, respectively
%   flow ... maximum flow found
%
% Example: Max. flow and min. cut in the following graph
%
%        SOURCE
%       /       \
%     1/         \2
%     /      3    \
%   node1 -----> node2
%     |   <-----   |
%     |      4     |
%     \            /
%     5\          /6
%       \        /
%          SINK
%
% is computed as follows:
%   STE = [1 5; 2 6]'; E_n = [1 2]'; E_w = [3 4]';
%   [cut,flow] = vgg_graph_maxflow(int16(STE),uint32(E_n),int16(E_w));
%
% vgg_graph_maxflow is a mexified C++ code downloaded from www page of Vladimir Kolmogorov.
% To acknowledge him, see vgg_graph_maxflow.cxx for details.

% Mexification done by werner@robots.ox.ac.uk, Oct 2002.