# HG changeset patch # User jacint # Date 1084004324 0 # Node ID 04cd483c2dbcea984577b3c746102a694f871d68 # Parent 26e1cd224bdcf87e997cce4440cf4f922058f509 aprosagok diff -r 26e1cd224bdc -r 04cd483c2dbc src/work/jacint/max_matching.h --- a/src/work/jacint/max_matching.h Fri May 07 21:16:26 2004 +0000 +++ b/src/work/jacint/max_matching.h Sat May 08 08:18:44 2004 +0000 @@ -71,7 +71,7 @@ public: - MaxMatching(Graph& _G) : G(_G), mate(_G,INVALID), position(_G,C) {} + MaxMatching(const Graph& _G) : G(_G), mate(_G,INVALID), position(_G,C) {} ///Runs Edmonds' algorithm. @@ -79,7 +79,7 @@ ///2*nodeNum), and a heuristical Edmonds' algorithm with a ///heuristic of postponing shrinks for dense graphs. \pre Before ///the subsequent calls \ref resetPos must be called. - void run(); + inline void run(); ///Runs Edmonds' algorithm. @@ -99,7 +99,7 @@ ///Returns the size of the actual matching stored. After \ref ///run() it returns the size of a maximum matching in the graph. - int size(); + int size () const; ///Resets the map storing the Gallai-Edmonds decomposition. @@ -134,7 +134,7 @@ ///resulting map will be \e symmetric, i.e. if \c map[u]=v then \c ///map[v]=u will hold, and now \c uv is an edge of the matching. template - void writeNMapNode(NMapN& map) { + void writeNMapNode (NMapN& map) const { NodeIt v; for( G.first(v); G.valid(v); G.next(v)) { map.set(v,mate[v]); @@ -164,7 +164,7 @@ ///G.bNode(map[u])=v then \c G.bNode(map[v])=u holds, and now this ///edge is an edge of the matching. template - void writeNMapEdge(NMapE& map) { + void writeNMapEdge (NMapE& map) const { typename Graph::template NodeMap todo(G,false); NodeIt v; for( G.first(v); G.valid(v); G.next(v)) { @@ -212,7 +212,7 @@ ///\c e, \c f with \c map[e]=map[f]=true. The edges \c e with \c ///map[e]=true form the matching. template - void writeEMapBool(EMapB& map) { + void writeEMapBool (EMapB& map) const { typename Graph::template NodeMap todo(G,false); NodeIt v; for( G.first(v); G.valid(v); G.next(v)) { @@ -241,7 +241,7 @@ ///\ref resetPos(), it writes the Gallai-Edmonds canonical ///decomposition of the graph. \c map must be a node map of \ref pos_enum 's. template - void writePos(NMapEnum& map) { + void writePos (NMapEnum& map) const { NodeIt v; for( G.first(v); G.valid(v); G.next(v)) map.set(v,position[v]); } @@ -456,7 +456,7 @@ } template - int MaxMatching::size() { + int MaxMatching::size() const { int s=0; NodeIt v; for(G.first(v); G.valid(v); G.next(v) ) {