Grafalgo
Library of useful data structures and algorithms
|
00001 // AltPath(G,M) class encapsulates data and methods use for alternating 00002 // path algorithm for max size matching. Use constructor to invoke algorithm 00003 00004 #ifndef FALTPATH_H 00005 #define FALTPATH_H 00006 00007 #include "stdinc.h" 00008 #include "Graph.h" 00009 #include "List.h" 00010 #include "Dlist.h" 00011 00012 using namespace grafalgo; 00013 00014 class faltPath { 00015 public: 00016 faltPath(Graph&,Dlist&,int&); 00017 private: 00018 Graph* graf; // graph we're finding matching for 00019 Dlist* match; // matching we're building 00020 00021 enum stype {odd, even}; 00022 stype* state; // odd/even status of vertices 00023 int* visit; // visit[u]=# of most recent search to visit u 00024 edge* mEdge; // mEdge[u]=matching edge incident to u 00025 edge* pEdge; // pEdge[u]=edge to parent of u in forest 00026 Dlist* free; // list of free vertices 00027 List* leaves; // list of leaves in current forest 00028 00029 int sNum; // index of current search 00030 00031 void augment(edge); // augment the matching 00032 edge findPath(); // find an augmenting path 00033 edge expand(vertex); // expand tree at given vertex 00034 }; 00035 00036 #endif