Grafalgo
Library of useful data structures and algorithms
|
00001 // Header file for class that implements Edmond's algorithm for 00002 // finding a maximum size matching in a general graph. To use, 00003 // invoke the constructor. 00004 00005 #ifndef FASTEDMONDS_H 00006 #define FASTEDMONDS_H 00007 00008 #include "stdinc.h" 00009 #include "Graph.h" 00010 #include "List.h" 00011 #include "Dlist.h" 00012 #include "RlistSet.h" 00013 #include "Partition.h" 00014 00015 using namespace grafalgo; 00016 00017 class fastEdmonds { 00018 public: fastEdmonds(Graph&,Dlist&,int&); 00019 string& statString(bool, string&); 00020 private: 00021 Graph* graf; 00022 Dlist* match; 00023 Partition *blossoms; 00024 RlistSet* augpath; 00025 vertex* origin; 00026 00027 struct BridgePair { 00028 edge e; vertex v; 00029 }; 00030 BridgePair *bridge; 00031 00032 00033 enum stype {unreached, odd, even}; 00034 stype *state; 00035 edge* mEdge; 00036 edge* pEdge; 00037 bool* mark; 00038 int searchNum; 00039 int* latestSearch; 00040 00041 edge* nextEdge; 00042 List* pending; 00043 Dlist* unmatched; 00044 00045 int iSize, mSize, stepCount, blossomCount; 00046 int imatchTime, rmatchTime, pathInitTime, pathFindTime; 00047 00048 vertex nca(vertex,vertex); // return nearest-common ancestor 00049 edge path(vertex,vertex); // construct augmenting path 00050 void augment(edge); // augment the matching 00051 edge findpath(); // find an altmenting path 00052 }; 00053 00054 #endif