Grafalgo
Library of useful data structures and algorithms
|
00001 // usage: maxFlo method 00002 // 00003 // MaxFlo reads a flograph from stdin, computes a maximum flow 00004 // using the method specified by the argument and then prints the 00005 // flograph with the max flow. 00006 // 00007 00008 #include "stdinc.h" 00009 #include "Flograph.h" 00010 #include "maxCap.h" 00011 #include "capScale.h" 00012 #include "shortPath.h" 00013 #include "dinic.h" 00014 #include "dinicDtrees.h" 00015 #include "prePush.h" 00016 #include "ppFifo.h" 00017 #include "ppHiLab.h" 00018 00019 int main(int argc, char *argv[]) { 00020 int floVal; 00021 Flograph fg; cin >> fg; 00022 00023 if (argc != 2) Util::fatal("usage: maxFlo method"); 00024 00025 if (strcmp(argv[1],"maxCap") == 0) 00026 maxCap(fg,floVal); 00027 else if (strcmp(argv[1],"capScale") == 0) 00028 capScale(fg,floVal); 00029 else if (strcmp(argv[1],"shortPath") == 0) 00030 shortPath(fg,floVal); 00031 else if (strcmp(argv[1],"dinic") == 0) 00032 dinic(fg,floVal); 00033 else if (strcmp(argv[1],"dinicDtrees") == 0) 00034 dinicDtrees(fg,floVal); 00035 else if (strcmp(argv[1],"ppFifo") == 0) 00036 ppFifo(fg,floVal,false); 00037 else if (strcmp(argv[1],"ppFifoBatch") == 0) 00038 ppFifo(fg,floVal,true); 00039 else if (strcmp(argv[1],"ppHiLab") == 0) 00040 ppHiLab(fg,floVal,false); 00041 else if (strcmp(argv[1],"ppHiLabBatch") == 0) 00042 ppHiLab(fg,floVal,true); 00043 else 00044 Util::fatal("maxFlo: undefined method"); 00045 00046 string s; 00047 cout << fg << "total flow of " << floVal << endl; 00048 exit(0); 00049 }