1
.TH max_flow 1 "September 1995" "Scilab Group" "Scilab function"
4
max_flow - maximum flow between two nodes
7
[v,phi,flag] = max_flow(i,j,g)
12
: integer, number of start node
15
: integer, number of end node
21
: value of the maximum flow it is exists
24
: row vector of the value of the flow on the arcs
27
: feasible problem flag (0 or 1)
29
\fVmax_flow\fR returns the value of maximum flow \fVv\fR from node number
30
\fVi\fR to node number \fVj\fR if it exists, and the value of the flow
31
on each arc as a row vector \fVphi\fR. All the computations are made with
32
integer numbers. The graph must be directed. If the problem is not
33
feasible, \fVflag\fR is equal to 0, otherwise it is equal to 1.
35
The bounds of the flow are given by the elements \fVedge_min_cap\fR and
36
\fVedge_max_cap\fR of the graph list.
37
The value of the maximum capacity must be greater than or equal to the
38
value of the minimum capacity.
39
If the value of \fVedge_min_cap\fR or \fVedge_max_cap\fR is not given (empty
40
row vector \fV[]\fR), it is assumed to be equal to 0 on each edge.
43
ta=[1 1 2 2 3 3 4 4 5 5 5 5 6 6 6 7 7 15 15 15 15 15 15];
44
ta=[ta, 15 8 9 10 11 12 13 14];
45
he=[10 13 9 14 8 11 9 11 8 10 12 13 8 9 12 8 11 1 2 3 4];
46
he=[he, 5 6 7 16 16 16 16 16 16 16];
48
g=make_graph('foo',1,n,ta,he);
49
g('node_x')=[42 615 231 505 145 312 403 233 506 34 400 312 142 614 260 257];
50
g('node_y')=[143 145 154 154 147 152 157 270 273 279 269 273 273 274 50 376];
52
g('edge_max_cap')=ones(1,ma);
53
g('edge_min_cap')=zeros(1,ma);
55
nodetype=0*ones(1,n); nodetype(source)=2; nodetype(sink)=1;
56
g('node_type')=nodetype;
57
nodecolor=0*ones(1,n); nodecolor(source)=11; nodecolor(sink)=11;
58
g('node_color')=nodecolor;
60
[v,phi,ierr]=max_flow(source,sink,g);
61
ii=find(phi<>0); edgecolor=phi; edgecolor(ii)=11*ones(ii);
62
g('edge_color')=edgecolor;
63
edgefontsize=8*ones(1,ma); edgefontsize(ii)=18*ones(ii);
64
g('edge_font_size')=edgefontsize;
65
g('edge_label')=string(phi);