[Lemon-commits] Alpar Juttner: Merge

Lemon HG hg at lemon.cs.elte.hu
Thu Sep 11 12:11:59 CEST 2008


details:   http://lemon.cs.elte.hu/hg/lemon/rev/c691064dfd4f
changeset: 260:c691064dfd4f
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Thu Sep 11 11:10:44 2008 +0100
description:
	Merge

diffstat:

5 files changed, 132 insertions(+), 133 deletions(-)
lemon/bfs.h                |   73 +++++++++++++++++++--------------------
lemon/bits/base_extender.h |   36 ++++++++++---------
lemon/dfs.h                |   73 +++++++++++++++++++--------------------
lemon/dijkstra.h           |   81 +++++++++++++++++++++-----------------------
test/heap_test.cc          |    2 -

diffs (truncated from 700 to 300 lines):

diff -r 362415050b29 -r c691064dfd4f lemon/bfs.h
--- a/lemon/bfs.h	Wed Sep 10 11:23:41 2008 +0100
+++ b/lemon/bfs.h	Thu Sep 11 11:10:44 2008 +0100
@@ -230,7 +230,7 @@
     ///@{
 
     template <class T>
-    struct DefPredMapTraits : public Traits {
+    struct SetPredMapTraits : public Traits {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &)
       {
@@ -243,12 +243,12 @@
     ///\ref named-templ-param "Named parameter" for setting
     ///\ref PredMap type.
     template <class T>
-    struct DefPredMap : public Bfs< Digraph, DefPredMapTraits<T> > {
-      typedef Bfs< Digraph, DefPredMapTraits<T> > Create;
+    struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > {
+      typedef Bfs< Digraph, SetPredMapTraits<T> > Create;
     };
 
     template <class T>
-    struct DefDistMapTraits : public Traits {
+    struct SetDistMapTraits : public Traits {
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &)
       {
@@ -261,12 +261,12 @@
     ///\ref named-templ-param "Named parameter" for setting
     ///\ref DistMap type.
     template <class T>
-    struct DefDistMap : public Bfs< Digraph, DefDistMapTraits<T> > {
-      typedef Bfs< Digraph, DefDistMapTraits<T> > Create;
+    struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > {
+      typedef Bfs< Digraph, SetDistMapTraits<T> > Create;
     };
 
     template <class T>
-    struct DefReachedMapTraits : public Traits {
+    struct SetReachedMapTraits : public Traits {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &)
       {
@@ -279,12 +279,12 @@
     ///\ref named-templ-param "Named parameter" for setting
     ///\ref ReachedMap type.
     template <class T>
-    struct DefReachedMap : public Bfs< Digraph, DefReachedMapTraits<T> > {
-      typedef Bfs< Digraph, DefReachedMapTraits<T> > Create;
+    struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > {
+      typedef Bfs< Digraph, SetReachedMapTraits<T> > Create;
     };
 
     template <class T>
-    struct DefProcessedMapTraits : public Traits {
+    struct SetProcessedMapTraits : public Traits {
       typedef T ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &)
       {
@@ -297,11 +297,11 @@
     ///\ref named-templ-param "Named parameter" for setting
     ///\ref ProcessedMap type.
     template <class T>
-    struct DefProcessedMap : public Bfs< Digraph, DefProcessedMapTraits<T> > {
-      typedef Bfs< Digraph, DefProcessedMapTraits<T> > Create;
+    struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > {
+      typedef Bfs< Digraph, SetProcessedMapTraits<T> > Create;
     };
 
-    struct DefDigraphProcessedMapTraits : public Traits {
+    struct SetStandardProcessedMapTraits : public Traits {
       typedef typename Digraph::template NodeMap<bool> ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &g)
       {
@@ -314,10 +314,9 @@
     ///\ref named-templ-param "Named parameter" for setting
     ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
     ///If you don't set it explicitly, it will be automatically allocated.
-    template <class T>
-    struct DefProcessedMapToBeDefaultMap :
-      public Bfs< Digraph, DefDigraphProcessedMapTraits> {
-      typedef Bfs< Digraph, DefDigraphProcessedMapTraits> Create;
+    struct SetStandardProcessedMap :
+      public Bfs< Digraph, SetStandardProcessedMapTraits > {
+      typedef Bfs< Digraph, SetStandardProcessedMapTraits > Create;
     };
 
     ///@}
@@ -1065,10 +1064,10 @@
     }
 
     template<class T>
-    struct DefPredMapBase : public Base {
+    struct SetPredMapBase : public Base {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &) { return 0; };
-      DefPredMapBase(const TR &b) : TR(b) {}
+      SetPredMapBase(const TR &b) : TR(b) {}
     };
     ///\brief \ref named-templ-param "Named parameter"
     ///for setting \ref PredMap object.
@@ -1076,17 +1075,17 @@
     /// \ref named-templ-param "Named parameter"
     ///for setting \ref PredMap object.
     template<class T>
-    BfsWizard<DefPredMapBase<T> > predMap(const T &t)
+    BfsWizard<SetPredMapBase<T> > predMap(const T &t)
     {
       Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return BfsWizard<DefPredMapBase<T> >(*this);
+      return BfsWizard<SetPredMapBase<T> >(*this);
     }
 
     template<class T>
-    struct DefReachedMapBase : public Base {
+    struct SetReachedMapBase : public Base {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &) { return 0; };
-      DefReachedMapBase(const TR &b) : TR(b) {}
+      SetReachedMapBase(const TR &b) : TR(b) {}
     };
     ///\brief \ref named-templ-param "Named parameter"
     ///for setting \ref ReachedMap object.
@@ -1094,17 +1093,17 @@
     /// \ref named-templ-param "Named parameter"
     ///for setting \ref ReachedMap object.
     template<class T>
-    BfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
+    BfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
     {
       Base::_reached=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return BfsWizard<DefReachedMapBase<T> >(*this);
+      return BfsWizard<SetReachedMapBase<T> >(*this);
     }
 
     template<class T>
-    struct DefProcessedMapBase : public Base {
+    struct SetProcessedMapBase : public Base {
       typedef T ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
-      DefProcessedMapBase(const TR &b) : TR(b) {}
+      SetProcessedMapBase(const TR &b) : TR(b) {}
     };
     ///\brief \ref named-templ-param "Named parameter"
     ///for setting \ref ProcessedMap object.
@@ -1112,17 +1111,17 @@
     /// \ref named-templ-param "Named parameter"
     ///for setting \ref ProcessedMap object.
     template<class T>
-    BfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
+    BfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
     {
       Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return BfsWizard<DefProcessedMapBase<T> >(*this);
+      return BfsWizard<SetProcessedMapBase<T> >(*this);
     }
 
     template<class T>
-    struct DefDistMapBase : public Base {
+    struct SetDistMapBase : public Base {
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &) { return 0; };
-      DefDistMapBase(const TR &b) : TR(b) {}
+      SetDistMapBase(const TR &b) : TR(b) {}
     };
     ///\brief \ref named-templ-param "Named parameter"
     ///for setting \ref DistMap object.
@@ -1130,10 +1129,10 @@
     /// \ref named-templ-param "Named parameter"
     ///for setting \ref DistMap object.
     template<class T>
-    BfsWizard<DefDistMapBase<T> > distMap(const T &t)
+    BfsWizard<SetDistMapBase<T> > distMap(const T &t)
     {
       Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return BfsWizard<DefDistMapBase<T> >(*this);
+      return BfsWizard<SetDistMapBase<T> >(*this);
     }
 
   };
@@ -1354,7 +1353,7 @@
 
     ///@{
     template <class T>
-    struct DefReachedMapTraits : public Traits {
+    struct SetReachedMapTraits : public Traits {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &digraph) {
         throw UninitializedParameter();
@@ -1365,9 +1364,9 @@
     ///
     /// \ref named-templ-param "Named parameter" for setting ReachedMap type.
     template <class T>
-    struct DefReachedMap : public BfsVisit< Digraph, Visitor,
-                                            DefReachedMapTraits<T> > {
-      typedef BfsVisit< Digraph, Visitor, DefReachedMapTraits<T> > Create;
+    struct SetReachedMap : public BfsVisit< Digraph, Visitor,
+                                            SetReachedMapTraits<T> > {
+      typedef BfsVisit< Digraph, Visitor, SetReachedMapTraits<T> > Create;
     };
     ///@}
 
diff -r 362415050b29 -r c691064dfd4f lemon/bits/base_extender.h
--- a/lemon/bits/base_extender.h	Wed Sep 10 11:23:41 2008 +0100
+++ b/lemon/bits/base_extender.h	Thu Sep 11 11:10:44 2008 +0100
@@ -59,7 +59,7 @@
     public:
       Arc() {}
 
-      /// Invalid arc constructor
+      // Invalid arc constructor
       Arc(Invalid i) : Edge(i), forward(true) {}
 
       bool operator==(const Arc &that) const {
@@ -74,38 +74,41 @@
       }
     };
 
+    /// First node of the edge
+    Node u(const Edge &e) const {
+      return Parent::source(e);
+    }
 
-
-    using Parent::source;
-
-    /// Source of the given Arc.
+    /// Source of the given arc
     Node source(const Arc &e) const {
       return e.forward ? Parent::source(e) : Parent::target(e);
     }
 
-    using Parent::target;
+    /// Second node of the edge
+    Node v(const Edge &e) const {
+      return Parent::target(e);
+    }
 
-    /// Target of the given Arc.
+    /// Target of the given arc
     Node target(const Arc &e) const {
       return e.forward ? Parent::target(e) : Parent::source(e);
     }
 
     /// \brief Directed arc from an edge.
     ///
-    /// Returns a directed arc corresponding to the specified Edge.
-    /// If the given bool is true the given edge and the
-    /// returned arc have the same source node.
-    static Arc direct(const Edge &ue, bool d) {
-      return Arc(ue, d);
+    /// Returns a directed arc corresponding to the specified edge.
+    /// If the given bool is true, the first node of the given edge and
+    /// the source node of the returned arc are the same.
+    static Arc direct(const Edge &e, bool d) {
+      return Arc(e, d);
     }
 
-    /// Returns whether the given directed arc is same orientation as the
-    /// corresponding edge.
+    /// Returns whether the given directed arc has the same orientation
+    /// as the corresponding edge.
     ///
     /// \todo reference to the corresponding point of the undirected digraph
     /// concept. "What does the direction of an edge mean?"
-    static bool direction(const Arc &e) { return e.forward; }
-
+    static bool direction(const Arc &a) { return a.forward; }
 
     using Parent::first;
     using Parent::next;
@@ -228,7 +231,6 @@
     int maxEdgeId() const {
       return Parent::maxArcId();
     }
-
 
     int arcNum() const {
       return 2 * Parent::arcNum();
diff -r 362415050b29 -r c691064dfd4f lemon/dfs.h
--- a/lemon/dfs.h	Wed Sep 10 11:23:41 2008 +0100
+++ b/lemon/dfs.h	Thu Sep 11 11:10:44 2008 +0100
@@ -230,7 +230,7 @@
     ///@{
 
     template <class T>
-    struct DefPredMapTraits : public Traits {
+    struct SetPredMapTraits : public Traits {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &)
       {
@@ -243,12 +243,12 @@
     ///\ref named-templ-param "Named parameter" for setting
     ///\ref PredMap type.
     template <class T>
-    struct DefPredMap : public Dfs<Digraph, DefPredMapTraits<T> > {
-      typedef Dfs<Digraph, DefPredMapTraits<T> > Create;
+    struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > {
+      typedef Dfs<Digraph, SetPredMapTraits<T> > Create;



More information about the Lemon-commits mailing list