Grafalgo
Library of useful data structures and algorithms
|
00001 // usage: maxFloMin method 00002 // 00003 // MaxFloMin reads a Mflograph from stdin, computes a maximum flow 00004 // for the graph, respecting the specified minimum flow constraints, 00005 // then prints the Mflograph, showing the resulting max flow. 00006 // 00007 // If there is no feasilbe flow, it simply prints a message to that effect.` 00008 // 00009 00010 #include "stdinc.h" 00011 #include "Mflograph.h" 00012 #include "minFlow.h" 00013 00014 int main(int argc, char *argv[]) { 00015 Mflograph fg; fg.read(cin); 00016 00017 if (argc != 1) fatal("usage: maxFloMin method"); 00018 00019 int floVal; 00020 minFlow(fg,floVal); 00021 00022 if (floVal >= 0) { 00023 string s; 00024 cout << fg.toString(s) << "total flow of " << floVal << endl; 00025 } else { 00026 cout << "no feasible flow" << endl; 00027 } 00028 }