[Lemon-commits] [lemon_svn] alpar: r2091 - in hugo/trunk: demo doc lemon lemon/bits

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


Author: alpar
Date: Tue Jul 26 15:15:13 2005
New Revision: 2091

Modified:
   hugo/trunk/demo/graph_to_eps_demo.cc
   hugo/trunk/doc/groups.dox
   hugo/trunk/lemon/bits/alteration_notifier.h
   hugo/trunk/lemon/bits/array_map.h
   hugo/trunk/lemon/bits/default_map.h
   hugo/trunk/lemon/bits/map_iterator.h
   hugo/trunk/lemon/bits/vector_map.h
   hugo/trunk/lemon/max_matching.h

Log:
Doc improvements

Modified: hugo/trunk/demo/graph_to_eps_demo.cc
==============================================================================
--- hugo/trunk/demo/graph_to_eps_demo.cc	(original)
+++ hugo/trunk/demo/graph_to_eps_demo.cc	Tue Jul 26 15:15:13 2005
@@ -20,10 +20,11 @@
 ///
 /// This demo program shows examples how to  use the function \ref
 /// graphToEps(). It takes no input but simply creates  six
-/// <tt>.eps</tt> files demonstrating how to draw directed/undirected
-/// graphs, how to handle parallel egdes, how to change the properties
-/// (like color, shape, size, title etc.) of nodes and edges
-/// individually using appropriate \ref maps-page "graphmaps".
+/// <tt>.eps</tt> files demonstrating the capability of \ref
+/// graphToEps(), and showing how to draw directed/undirected graphs,
+/// how to handle parallel egdes, how to change the properties (like
+/// color, shape, size, title etc.) of nodes and edges individually
+/// using appropriate \ref maps-page "graphmapfactory".
 
 #include <cmath>
 

Modified: hugo/trunk/doc/groups.dox
==============================================================================
--- hugo/trunk/doc/groups.dox	(original)
+++ hugo/trunk/doc/groups.dox	Tue Jul 26 15:15:13 2005
@@ -164,7 +164,7 @@
 graph structures and helper classes used to implement these.
 */
 
-/**
+/* --- Unused group
 @defgroup experimental Experimental Structures and Algorithms
 This group contains some Experimental structures and algorithms.
 The stuff here is subject to change.

Modified: hugo/trunk/lemon/bits/alteration_notifier.h
==============================================================================
--- hugo/trunk/lemon/bits/alteration_notifier.h	(original)
+++ hugo/trunk/lemon/bits/alteration_notifier.h	Tue Jul 26 15:15:13 2005
@@ -20,13 +20,13 @@
 #include <vector>
 #include <algorithm>
 
-///\ingroup graphmaps
+///\ingroup graphmapfactory
 ///\file
 ///\brief Observer registry for graph alteration observers.
 
 namespace lemon {
 
-  /// \addtogroup graphmaps
+  /// \addtogroup graphmapfactory
   /// @{
 
   /// \brief Registry class to register objects observes alterations in 

Modified: hugo/trunk/lemon/bits/array_map.h
==============================================================================
--- hugo/trunk/lemon/bits/array_map.h	(original)
+++ hugo/trunk/lemon/bits/array_map.h	Tue Jul 26 15:15:13 2005
@@ -20,7 +20,7 @@
 #include <memory>
 #include <lemon/bits/map_iterator.h>
 
-///\ingroup graphmaps
+///\ingroup graphmapfactory
 ///\file
 ///\brief Graph maps that construates and destruates
 ///their elements dynamically.
@@ -28,7 +28,7 @@
 namespace lemon {
 
 
-  /// \addtogroup graphmaps
+  /// \addtogroup graphmapfactory
   /// @{
 	
   /// The ArrayMap template class is graph map structure what

Modified: hugo/trunk/lemon/bits/default_map.h
==============================================================================
--- hugo/trunk/lemon/bits/default_map.h	(original)
+++ hugo/trunk/lemon/bits/default_map.h	Tue Jul 26 15:15:13 2005
@@ -21,14 +21,14 @@
 #include <lemon/bits/array_map.h>
 #include <lemon/bits/vector_map.h>
 
-///\ingroup graphmaps
+///\ingroup graphmapfactory
 ///\file
 ///\brief Graph maps that construct and destruct
 ///their elements dynamically.
 
 namespace lemon {
 
-/// \addtogroup graphmaps
+/// \addtogroup graphmapfactory
 /// @{
 
   /** The ArrayMap template class is graph map structure what

Modified: hugo/trunk/lemon/bits/map_iterator.h
==============================================================================
--- hugo/trunk/lemon/bits/map_iterator.h	(original)
+++ hugo/trunk/lemon/bits/map_iterator.h	Tue Jul 26 15:15:13 2005
@@ -22,13 +22,13 @@
 #include <lemon/bits/extended_pair.h>
 #include <lemon/graph_utils.h>
 
-///\ingroup graphmaps
+///\ingroup graphmapfactory
 ///\file
 ///\brief Iterators on the maps.
 
 namespace lemon {
 
-  /// \addtogroup graphmaps
+  /// \addtogroup graphmapfactory
   /// @{
 
   /** The base class all of the map iterators.

Modified: hugo/trunk/lemon/bits/vector_map.h
==============================================================================
--- hugo/trunk/lemon/bits/vector_map.h	(original)
+++ hugo/trunk/lemon/bits/vector_map.h	Tue Jul 26 15:15:13 2005
@@ -24,13 +24,13 @@
 #include <lemon/bits/map_iterator.h>
 #include <lemon/bits/alteration_notifier.h>
 
-///\ingroup graphmaps
+///\ingroup graphmapfactory
 ///\file
 ///\brief Vector based graph maps.
 
 namespace lemon {
   
-  /// \addtogroup graphmaps
+  /// \addtogroup graphmapfactory
   /// @{
   
   /// The VectorMap template class is graph map structure what

Modified: hugo/trunk/lemon/max_matching.h
==============================================================================
--- hugo/trunk/lemon/max_matching.h	(original)
+++ hugo/trunk/lemon/max_matching.h	Tue Jul 26 15:15:13 2005
@@ -97,32 +97,88 @@
     ///Runs Edmonds' algorithm for sparse graphs (number of edges <
     ///2*number of nodes), and a heuristical Edmonds' algorithm with a
     ///heuristic of postponing shrinks for dense graphs. 
-    inline void run();
+    void run() {
+      if ( countUndirEdges(g) < HEUR_density*countNodes(g) ) {
+	greedyMatching();
+	runEdmonds(0);
+      } else runEdmonds(1);
+    }
+
 
     ///Runs Edmonds' algorithm.
     
     ///If heur=0 it runs Edmonds' algorithm. If heur=1 it runs
     ///Edmonds' algorithm with a heuristic of postponing shrinks,
     ///giving a faster algorithm for dense graphs.  
-    void runEdmonds( int heur );
+    void runEdmonds( int heur = 1 ) {
+      
+      for(NodeIt v(g); v!=INVALID; ++v)
+	position.set(v,C);      
+      
+      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 
+      
+      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 ) {
+	  blossom.insert(v);
+	  tree.insert(v); 
+	  position.set(v,D);
+	  if ( heur == 1 ) lateShrink( v, ear, blossom, tree );
+	  else normShrink( v, ear, blossom, tree );
+	}
+      }
+    }
+
 
     ///Finds a greedy matching starting from the actual matching.
     
     ///Starting form the actual matching stored, it finds a maximal
     ///greedy matching.
-    void greedyMatching();
+    void greedyMatching() {
+      for(NodeIt v(g); v!=INVALID; ++v)
+	if ( _mate[v]==INVALID ) {
+	  for( IncEdgeIt e(g,v); e!=INVALID ; ++e ) {
+	    Node y=g.runningNode(e);
+	    if ( _mate[y]==INVALID && y!=v ) {
+	      _mate.set(v,y);
+	      _mate.set(y,v);
+	      break;
+	    }
+	  }
+	} 
+    }
 
     ///Returns the size of the actual matching stored.
 
     ///Returns the size of the actual matching stored. After \ref
     ///run() it returns the size of a maximum matching in the graph.
-    int size() const;
+    int size() const {
+      int s=0;
+      for(NodeIt v(g); v!=INVALID; ++v) {
+	if ( _mate[v]!=INVALID ) {
+	  ++s;
+	}
+      }
+      return s/2;
+    }
+
 
     ///Resets the actual matching to the empty matching.
 
     ///Resets the actual matching to the empty matching.  
     ///
-    void resetMatching();
+    void resetMatching() {
+      for(NodeIt v(g); v!=INVALID; ++v)
+	_mate.set(v,INVALID);      
+    }
 
     ///Returns the mate of a node in the actual matching.
 
@@ -284,44 +340,6 @@
 
 
   template <typename Graph>
-  void MaxMatching<Graph>::run() {
-    if ( countUndirEdges(g) < HEUR_density*countNodes(g) ) {
-      greedyMatching();
-      runEdmonds(0);
-    } else runEdmonds(1);
-  }
-
-
-  template <typename Graph>
-  void MaxMatching<Graph>::runEdmonds( int heur=1 ) {
-
-    for(NodeIt v(g); v!=INVALID; ++v)
-      position.set(v,C);      
-
-    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 
-
-    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 ) {
-	blossom.insert(v);
-	tree.insert(v); 
-	position.set(v,D);
-	if ( heur == 1 ) lateShrink( v, ear, blossom, tree );
-	else normShrink( v, ear, blossom, tree );
-      }
-    }
-  }
-
-    
-  template <typename Graph>
   void MaxMatching<Graph>::lateShrink(Node v, typename Graph::template NodeMap<Node>& ear,  
 				      UFE& blossom, UFE& tree) {
 
@@ -460,38 +478,6 @@
   }
 
   template <typename Graph>
-  void MaxMatching<Graph>::greedyMatching() {
-    for(NodeIt v(g); v!=INVALID; ++v)
-      if ( _mate[v]==INVALID ) {
-	for( IncEdgeIt e(g,v); e!=INVALID ; ++e ) {
-	  Node y=g.runningNode(e);
-	  if ( _mate[y]==INVALID && y!=v ) {
-	    _mate.set(v,y);
-	    _mate.set(y,v);
-	    break;
-	  }
-	}
-      } 
-  }
-   
-  template <typename Graph>
-  int MaxMatching<Graph>::size() const {
-    int s=0;
-    for(NodeIt v(g); v!=INVALID; ++v) {
-      if ( _mate[v]!=INVALID ) {
-	++s;
-      }
-    }
-    return s/2;
-  }
-
-  template <typename Graph>
-  void MaxMatching<Graph>::resetMatching() {
-    for(NodeIt v(g); v!=INVALID; ++v)
-      _mate.set(v,INVALID);      
-  }
-
-  template <typename Graph>
   bool MaxMatching<Graph>::noShrinkStep(Node x,
 					typename Graph::template 
 					NodeMap<Node>& ear,  



More information about the Lemon-commits mailing list