Grafalgo
Library of useful data structures and algorithms
|
00001 // DinicDtrees class. Encapsulates data and routines 00002 // used to implement Dinic's algorithm with dynamic trees. 00003 // Use constructor to invoke algorithm. 00004 00005 #ifndef DINICDTREES_H 00006 #define DINICDTREES_H 00007 00008 #include "stdinc.h" 00009 #include "Flograph.h" 00010 #include "PathSet.h" 00011 #include "Dtrees.h" 00012 #include "List.h" 00013 00014 using namespace grafalgo; 00015 00016 class dinicDtrees { 00017 public: 00018 dinicDtrees(Flograph&,int&); 00019 dinicDtrees(Flograph&,int&,string&); 00020 private: 00021 Flograph* fg; // graph we're finding flow on 00022 int* nextEdge; // pointer into adjacency list 00023 int* upEdge; // upEdge[u] is edge for dtrees link from u 00024 int* level; // level[u]=# of edges in path from source 00025 Dtrees* dt; // dynamic trees data structure 00026 00027 bool findPath(); // find augmenting path 00028 int augment(); // add flow to augmenting path 00029 bool newPhase(); // prepare for a new phase 00030 00031 // statistics 00032 int numPhase; 00033 int numPaths; 00034 long long int avgPathLength; 00035 uint32_t phaseTime; 00036 uint32_t pathTime; 00037 }; 00038 00039 #endif