[Lemon-commits] [lemon_svn] jacint: r1569 - hugo/trunk/src/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:46:16 CET 2006


Author: jacint
Date: Mon Feb 21 19:51:11 2005
New Revision: 1569

Modified:
   hugo/trunk/src/lemon/max_matching.h

Log:
some minor changes, docs, etc.

Modified: hugo/trunk/src/lemon/max_matching.h
==============================================================================
--- hugo/trunk/src/lemon/max_matching.h	(original)
+++ hugo/trunk/src/lemon/max_matching.h	Mon Feb 21 19:51:11 2005
@@ -54,6 +54,9 @@
   ///\author Jacint Szabo  
   template <typename Graph>
   class MaxMatching {
+
+  protected:
+
     typedef typename Graph::Node Node;
     typedef typename Graph::Edge Edge;
     typedef typename Graph::UndirEdgeIt UndirEdgeIt;
@@ -77,7 +80,7 @@
       C=2
     }; 
 
-  private:
+  protected:
 
     static const int HEUR_density=2;
     const Graph& g;
@@ -128,11 +131,11 @@
       return _mate[node];
     } 
 
-    ///Reads a matching from a \c Node map of \c Nodes.
+    ///Reads a matching from a \c Node valued \c Node map.
 
-    ///Reads a matching from a \c Node map of \c Nodes. This map must be \e
-    ///symmetric, i.e. if \c map[u]==v then \c map[v]==u must hold, and
-    ///\c uv will be an edge of the matching.
+    ///Reads a matching from a \c Node valued \c Node map. This map
+    ///must be \e symmetric, i.e. if \c map[u]==v then \c map[v]==u
+    ///must hold, and \c uv will be an edge of the matching.
     template<typename NMapN>
     void readNMapNode(NMapN& map) {
       for(NodeIt v(g); v!=INVALID; ++v) {
@@ -140,9 +143,9 @@
       } 
     } 
     
-    ///Writes the stored matching to a \c Node map of \c Nodes.
+    ///Writes the stored matching to a \c Node valued \c Node map.
 
-    ///Writes the stored matching to a \c Node map of \c Nodes. The
+    ///Writes the stored matching to a \c Node valued \c Node map. The
     ///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<typename NMapN>
@@ -152,27 +155,29 @@
       } 
     } 
 
-    ///Reads a matching from a \c Node map of \c Edges.
+    ///Reads a matching from an \c UndirEdge valued \c Node map.
 
-    ///Reads a matching from a \c Node map of incident \c Edges. This
-    ///map must have the property that if \c G.target(map[u])==v then \c
-    ///G.target(map[v])==u must hold, and now this edge is an edge of
-    ///the matching.
+    ///Reads a matching from an \c UndirEdge valued \c Node map. \c
+    ///map[v] must be an \c UndirEdge incident to \c v. This map must
+    ///have the property that if \c g.oppositeNode(u,map[u])==v then
+    ///\c \c g.oppositeNode(v,map[v])==u holds, and now some edge
+    ///joining \c u to \v will be an edge of the matching.
     template<typename NMapE>
     void readNMapEdge(NMapE& map) {
      for(NodeIt v(g); v!=INVALID; ++v) {
-	Edge e=map[v];
-	if ( g.valid(e) )
+	UndirEdge e=map[v];
+	if ( e!=INVALID )
 	  g.source(e) == v ? _mate.set(v,g.target(e)) : _mate.set(v,g.source(e)); 
       } 
     } 
     
-    ///Writes the matching stored to a \c Node map of \c Edges.
+    ///Writes the matching stored to an \c UndirEdge valued \c Node map.
 
-    ///Writes the stored matching to a \c Node map of incident \c
-    ///Edges. This map will have the property that if \c
-    ///g.target(map[u])==v then \c g.target(map[v])==u holds, and now this
-    ///edge is an edge of the matching.
+    ///Writes the stored matching to an \c UndirEdge valued \c Node
+    ///map. \c map[v] will be an \c UndirEdge incident to \c v. This
+    ///map will have the property that if \c g.oppositeNode(u,map[u])
+    ///== v then \c map[u]==map[v] holds, and now this edge is an edge
+    ///of the matching.
     template<typename NMapE>
     void writeNMapEdge (NMapE& map)  const {
       typename Graph::template NodeMap<bool> todo(g,true); 
@@ -193,11 +198,11 @@
     }
 
 
-    ///Reads a matching from an \c Edge map of \c bools.
+    ///Reads a matching from a \c bool valued \c Edge map.
     
-    ///Reads a matching from an \c Edge map of \c bools. This map must
-    ///have the property that there are no two adjacent edges \c e, \c
-    ///f with \c map[e]==map[f]==true. The edges \c e with \c
+    ///Reads a matching from a \c bool valued \c Edge map. This map
+    ///must have the property that there are no two incident edges \c
+    ///e, \c f with \c map[e]==map[f]==true. The edges \c e with \c
     ///map[e]==true form the matching.
     template<typename EMapB>
     void readEMapBool(EMapB& map) {
@@ -212,12 +217,12 @@
     }
 
 
-    ///Writes the matching stored to an \c Edge map of \c bools.
+    ///Writes the matching stored to a \c bool valued \c Edge map.
 
-    ///Writes the matching stored to an \c Edge map of \c bools. This
-    ///map will have the property that there are no two adjacent edges
-    ///\c e, \c f with \c map[e]==map[f]==true. The edges \c e with \c
-    ///map[e]==true form the matching.
+    ///Writes the matching stored to a \c bool valued \c Edge
+    ///map. This map will have the property that there are no two
+    ///incident edges \c e, \c f with \c map[e]==map[f]==true. The
+    ///edges \c e with \c map[e]==true form the matching.
     template<typename EMapB>
     void writeEMapBool (EMapB& map) const {
       for(UndirEdgeIt e(g); e!=INVALID; ++e) map.set(e,false);
@@ -252,6 +257,7 @@
 
   private: 
 
+ 
     void lateShrink(Node v, typename Graph::template NodeMap<Node>& ear,  
 		    UFE& blossom, UFE& tree);
 
@@ -292,12 +298,14 @@
 
     typename Graph::template NodeMap<Node> ear(g,INVALID); 
     //undefined for the base nodes of the blossoms (i.e. for the
-    //representative elements of UFE blossom) and for the nodes in C
- 
+    //representative elements of UFE blossom) and for the nodes in C 
+
     typename UFE::MapType blossom_base(g);
     UFE blossom(blossom_base);
     typename UFE::MapType tree_base(g);
     UFE tree(tree_base);
+    //If these UFE's would be members of the class then also
+    //blossom_base and tree_base should be a member.
 
     for(NodeIt v(g); v!=INVALID; ++v) {
       if ( position[v]==C && _mate[v]==INVALID ) {
@@ -471,7 +479,7 @@
 	++s;
       }
     }
-    return (int)s/2;
+    return s/2;
   }
 
   template <typename Graph>
@@ -562,4 +570,4 @@
   
 } //END OF NAMESPACE LEMON
 
-#endif //EDMONDS_H
+#endif //LEMON_MAX_MATCHING_H



More information about the Lemon-commits mailing list