[Lemon-commits] [lemon_svn] alpar: r1120 - hugo/trunk/src/hugo

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


Author: alpar
Date: Thu Sep  9 09:09:11 2004
New Revision: 1120

Modified:
   hugo/trunk/src/hugo/kruskal.h

Log:
Shorter template parameter names to be more readable in Doxygen.


Modified: hugo/trunk/src/hugo/kruskal.h
==============================================================================
--- hugo/trunk/src/hugo/kruskal.h	(original)
+++ hugo/trunk/src/hugo/kruskal.h	Thu Sep  9 09:09:11 2004
@@ -21,6 +21,7 @@
 ///
 ///Kruskal's algorithm to compute a minimum cost tree.
 
+///\weakgroup spantree
 namespace hugo {
 
   /// \addtogroup spantree
@@ -34,7 +35,7 @@
   ///
   /// \param in This object is used to describe the edge costs. It must
   /// be an STL compatible 'Forward Container'
-  /// with <tt>std::pair<Graph::Edge,X></tt> as its <tt>value_type</tt>,
+  /// with <tt>std::pair<GR::Edge,X></tt> as its <tt>value_type</tt>,
   /// where X is the type of the costs. It must contain every edge in
   /// cost-ascending order.
   ///\par
@@ -52,20 +53,20 @@
   ///
   /// \return The cost of the found tree.
 
-  template <typename Graph, typename InputEdgeOrder, typename OutBoolMap>
-  typename InputEdgeOrder::value_type::second_type
-  kruskal(Graph const& G, InputEdgeOrder const& in, 
-		 OutBoolMap& out)
+  template <class GR, class IN, class OUT>
+  typename IN::value_type::second_type
+  kruskal(GR const& G, IN const& in, 
+		 OUT& out)
   {
-    typedef typename InputEdgeOrder::value_type::second_type EdgeCost;
-    typedef typename Graph::template NodeMap<int> NodeIntMap;
-    typedef typename Graph::Node Node;
+    typedef typename IN::value_type::second_type EdgeCost;
+    typedef typename GR::template NodeMap<int> NodeIntMap;
+    typedef typename GR::Node Node;
 
     NodeIntMap comp(G, -1);
     UnionFind<Node,NodeIntMap> uf(comp); 
       
     EdgeCost tot_cost = 0;
-    for (typename InputEdgeOrder::const_iterator p = in.begin(); 
+    for (typename IN::const_iterator p = in.begin(); 
 	 p!=in.end(); ++p ) {
       if ( uf.join(G.head((*p).first),
 		   G.tail((*p).first)) ) {
@@ -83,7 +84,7 @@
 
   ///\bug What is this? Or why doesn't it work?
   ///
-  template<typename Map>
+  template<class Map>
   class NonConstMapWr {
     const Map &m;
   public:
@@ -91,17 +92,17 @@
 
     NonConstMapWr(const Map &_m) : m(_m) {}
 
-    template<typename KeyType>
+    template<class KeyType>
     void set(KeyType const& k, ValueType const &v) const { m.set(k,v); }
   };
 
-  template <typename Graph, typename InputEdgeOrder, typename OutBoolMap>
+  template <class GR, class IN, class OUT>
   inline
-  typename InputEdgeOrder::ValueType
-  kruskal(Graph const& G, InputEdgeOrder const& edges, 
-	  OutBoolMap const& out_map)
+  typename IN::ValueType
+  kruskal(GR const& G, IN const& edges, 
+	  OUT const& out_map)
   {
-    NonConstMapWr<OutBoolMap> map_wr(out_map);
+    NonConstMapWr<OUT> map_wr(out_map);
     return kruskal(G, edges, map_wr);
   }  
 
@@ -115,7 +116,7 @@
   ///
   /// \sa makeKruskalMapInput()
   ///
-  ///\param Graph The type of the graph the algorithm runs on.
+  ///\param GR The type of the graph the algorithm runs on.
   ///\param Map An edge map containing the cost of the edges.
   ///\par
   ///The cost type can be any type satisfying
@@ -123,13 +124,13 @@
   ///concept if it also has an operator+() implemented. (It is necessary for
   ///computing the total cost of the tree).
   ///
-  template<typename Graph, typename Map>
+  template<class GR, class Map>
   class KruskalMapInput
-    : public std::vector< std::pair<typename Graph::Edge,
+    : public std::vector< std::pair<typename GR::Edge,
 				    typename Map::ValueType> > {
     
   public:
-    typedef std::vector< std::pair<typename Graph::Edge,
+    typedef std::vector< std::pair<typename GR::Edge,
 				   typename Map::ValueType> > Parent;
     typedef typename Parent::value_type value_type;
 
@@ -148,8 +149,8 @@
       std::sort(this->begin(), this->end(), comparePair());
     }
 
-    KruskalMapInput(Graph const& G, Map const& m) {
-      typedef typename Graph::EdgeIt EdgeIt;
+    KruskalMapInput(GR const& G, Map const& m) {
+      typedef typename GR::EdgeIt EdgeIt;
       
       this->clear();
       for(EdgeIt e(G);e!=INVALID;++e) push_back(make_pair(e, m[e]));
@@ -176,11 +177,11 @@
   ///
   ///\return An appropriate input source for \ref kruskal().
   ///
-  template<typename Graph, typename Map>
+  template<class GR, class Map>
   inline
-  KruskalMapInput<Graph,Map> makeKruskalMapInput(const Graph &G,const Map &m)
+  KruskalMapInput<GR,Map> makeKruskalMapInput(const GR &G,const Map &m)
   {
-    return KruskalMapInput<Graph,Map>(G,m);
+    return KruskalMapInput<GR,Map>(G,m);
   }
   
   
@@ -194,7 +195,7 @@
   /// \bug Missing documentation.
   /// \todo This class may be of wider usage, therefore it could move to
   /// <tt>maps.h</tt>
-  template<typename Iterator>
+  template<class Iterator>
   class SequenceOutput {
     mutable Iterator it;
 
@@ -207,7 +208,7 @@
     void set(KeyType const& k, bool v) const { if(v) {*it=k; ++it;} }
   };
 
-  template<typename Iterator>
+  template<class Iterator>
   inline
   SequenceOutput<Iterator>
   makeSequenceOutput(Iterator it) {
@@ -240,14 +241,14 @@
   /// \return The cost of the found tree.
 
 
-  template <typename Graph, typename EdgeCostMap, typename RetEdgeBoolMap>
+  template <class GR, class IN, class RET>
   inline
-  typename EdgeCostMap::ValueType
-  kruskalEdgeMap(Graph const& G,
-		 EdgeCostMap const& in,
-		 RetEdgeBoolMap &out) {
+  typename IN::ValueType
+  kruskalEdgeMap(GR const& G,
+		 IN const& in,
+		 RET &out) {
     return kruskal(G,
-		   KruskalMapInput<Graph,EdgeCostMap>(G,in),
+		   KruskalMapInput<GR,IN>(G,in),
 		   out);
   }
 
@@ -266,11 +267,11 @@
   ///computing the total cost of the tree).
   ///
   /// \retval out This must be an iteraror of an STL Container with
-  /// <tt>Graph::Edge</tt> as its <tt>value_type</tt>.
+  /// <tt>GR::Edge</tt> as its <tt>value_type</tt>.
   /// The algorithm copies the elements of the found tree into this sequence.
   /// For example, if we know that the spanning tree of the graph \c G has
   /// say 53 edges then
-  /// we can put its edges into a vector \c tree with a code like this.
+  /// we can put its edges into a STL vector \c tree with a code like this.
   /// \code
   /// std::vector<Edge> tree(53);
   /// kruskalEdgeMap_IteratorOut(G,cost,tree.begin());
@@ -284,16 +285,16 @@
   /// \return The cost of the found tree.
   ///
   /// \bug its name does not follow the coding style.
-  template <typename Graph, typename EdgeCostMap, typename RetIterator>
+  template <class GR, class IN, class RET>
   inline
-  typename EdgeCostMap::ValueType
-  kruskalEdgeMap_IteratorOut(const Graph& G,
-			     const EdgeCostMap& in,
-			     RetIterator out)
+  typename IN::ValueType
+  kruskalEdgeMap_IteratorOut(const GR& G,
+			     const IN& in,
+			     RET out)
   {
-    SequenceOutput<RetIterator> _out(out);
+    SequenceOutput<RET> _out(out);
     return kruskal(G,
-		   KruskalMapInput<Graph, EdgeCostMap>(G, in),
+		   KruskalMapInput<GR,IN>(G, in),
 		   _out);
   }
 



More information about the Lemon-commits mailing list