[Lemon-commits] [lemon_svn] deba: r2739 - in hugo/trunk/lemon: . bits

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


Author: deba
Date: Fri May 12 11:51:45 2006
New Revision: 2739

Modified:
   hugo/trunk/lemon/bits/base_extender.h
   hugo/trunk/lemon/bits/graph_adaptor_extender.h
   hugo/trunk/lemon/bits/graph_extender.h
   hugo/trunk/lemon/edge_set.h
   hugo/trunk/lemon/full_graph.h
   hugo/trunk/lemon/grid_ugraph.h
   hugo/trunk/lemon/list_graph.h
   hugo/trunk/lemon/smart_graph.h

Log:
Extenders modified

UGraphBaseExtender => UndirGraphExtender
BpUGraphBaseExtender merged into BpUGraphExtender



Modified: hugo/trunk/lemon/bits/base_extender.h
==============================================================================
--- hugo/trunk/lemon/bits/base_extender.h	(original)
+++ hugo/trunk/lemon/bits/base_extender.h	Fri May 12 11:51:45 2006
@@ -37,7 +37,7 @@
   ///
   /// \brief BaseExtender for the UGraphs
   template <typename Base>
-  class UGraphBaseExtender : public Base {
+  class UndirGraphExtender : public Base {
 
   public:
 
@@ -48,7 +48,7 @@
     typedef True UndirectedTag;
 
     class Edge : public UEdge {
-      friend class UGraphBaseExtender;
+      friend class UndirGraphExtender;
 
     protected:
       bool forward;
@@ -275,208 +275,6 @@
     }
   };
 
-
-  /// \ingroup graphbits
-  ///
-  /// \brief BaseExtender for the BpUGraphs
-  template <typename Base>
-  class BpUGraphBaseExtender : public Base {
-  public:
-    typedef Base Parent;
-    typedef BpUGraphBaseExtender Graph;
-
-    typedef typename Parent::Node Node;
-    typedef typename Parent::Edge UEdge;
-
-
-    using Parent::first;
-    using Parent::next;
-
-    using Parent::id;
-
-    class ANode : public Node {
-      friend class BpUGraphBaseExtender;
-    public:
-      ANode() {}
-      ANode(const Node& node) : Node(node) {
-	LEMON_ASSERT(Parent::aNode(node) || node == INVALID, 
-		     typename Parent::NodeSetError());
-      }
-      ANode(Invalid) : Node(INVALID) {}
-    };
-
-    void first(ANode& node) const {
-      Parent::firstANode(static_cast<Node&>(node));
-    }
-    void next(ANode& node) const {
-      Parent::nextANode(static_cast<Node&>(node));
-    }
-
-    int id(const ANode& node) const {
-      return Parent::aNodeId(node);
-    }
-
-    class BNode : public Node {
-      friend class BpUGraphBaseExtender;
-    public:
-      BNode() {}
-      BNode(const Node& node) : Node(node) {
-	LEMON_ASSERT(Parent::bNode(node) || node == INVALID,
-		     typename Parent::NodeSetError());
-      }
-      BNode(Invalid) : Node(INVALID) {}
-    };
-
-    void first(BNode& node) const {
-      Parent::firstBNode(static_cast<Node&>(node));
-    }
-    void next(BNode& node) const {
-      Parent::nextBNode(static_cast<Node&>(node));
-    }
-  
-    int id(const BNode& node) const {
-      return Parent::aNodeId(node);
-    }
-
-    Node source(const UEdge& edge) const {
-      return aNode(edge);
-    }
-    Node target(const UEdge& edge) const {
-      return bNode(edge);
-    }
-
-    void firstInc(UEdge& edge, bool& direction, const Node& node) const {
-      if (Parent::aNode(node)) {
-	Parent::firstOut(edge, node);
-	direction = true;
-      } else {
-	Parent::firstIn(edge, node);
-	direction = static_cast<UEdge&>(edge) == INVALID;
-      }
-    }
-    void nextInc(UEdge& edge, bool& direction) const {
-      if (direction) {
-	Parent::nextOut(edge);
-      } else {
-	Parent::nextIn(edge);
-	if (edge == INVALID) direction = true;
-      }
-    }
-
-    int maxUEdgeId() const {
-      return Parent::maxEdgeId();
-    }
-
-    UEdge uEdgeFromId(int id) const {
-      return Parent::edgeFromId(id);
-    }
-
-    class Edge : public UEdge {
-      friend class BpUGraphBaseExtender;
-    protected:
-      bool forward;
-
-      Edge(const UEdge& edge, bool _forward)
-	: UEdge(edge), forward(_forward) {}
-
-    public:
-      Edge() {}
-      Edge (Invalid) : UEdge(INVALID), forward(true) {}
-      bool operator==(const Edge& i) const {
-	return UEdge::operator==(i) && forward == i.forward;
-      }
-      bool operator!=(const Edge& i) const {
-	return UEdge::operator!=(i) || forward != i.forward;
-      }
-      bool operator<(const Edge& i) const {
-	return UEdge::operator<(i) || 
-	  (!(i.forward<forward) && UEdge(*this)<UEdge(i));
-      }
-    };
-
-    void first(Edge& edge) const {
-      Parent::first(static_cast<UEdge&>(edge));
-      edge.forward = true;
-    }
-
-    void next(Edge& edge) const {
-      if (!edge.forward) {
-	Parent::next(static_cast<UEdge&>(edge));
-      }
-      edge.forward = !edge.forward;
-    }
-
-    void firstOut(Edge& edge, const Node& node) const {
-      if (Parent::aNode(node)) {
-	Parent::firstOut(edge, node);
-	edge.forward = true;
-      } else {
-	Parent::firstIn(edge, node);
-	edge.forward = static_cast<UEdge&>(edge) == INVALID;
-      }
-    }
-    void nextOut(Edge& edge) const {
-      if (edge.forward) {
-	Parent::nextOut(edge);
-      } else {
-	Parent::nextIn(edge);
-        edge.forward = static_cast<UEdge&>(edge) == INVALID;
-      }
-    }
-
-    void firstIn(Edge& edge, const Node& node) const {
-      if (Parent::bNode(node)) {
-	Parent::firstIn(edge, node);
-	edge.forward = true;	
-      } else {
-	Parent::firstOut(edge, node);
-	edge.forward = static_cast<UEdge&>(edge) == INVALID;
-      }
-    }
-    void nextIn(Edge& edge) const {
-      if (edge.forward) {
-	Parent::nextIn(edge);
-      } else {
-	Parent::nextOut(edge);
-	edge.forward = static_cast<UEdge&>(edge) == INVALID;
-      }
-    }
-
-    Node source(const Edge& edge) const {
-      return edge.forward ? Parent::aNode(edge) : Parent::bNode(edge);
-    }
-    Node target(const Edge& edge) const {
-      return edge.forward ? Parent::bNode(edge) : Parent::aNode(edge);
-    }
-
-    int id(const Edge& edge) const {
-      return (Parent::id(edge) << 1) + (edge.forward ? 0 : 1);
-    }
-    Edge edgeFromId(int id) const {
-      return Edge(Parent::fromId(id >> 1, UEdge()), (id & 1) == 0);
-    }
-    int maxEdgeId() const {
-      return (Parent::maxId(UEdge()) << 1) + 1;
-    }
-
-    bool direction(const Edge& edge) const {
-      return edge.forward;
-    }
-
-    Edge direct(const UEdge& edge, bool direction) const {
-      return Edge(edge, direction);
-    }
-
-    int edgeNum() const {
-      return 2 * Parent::edgeNum();
-    }
-
-    int uEdgeNum() const {
-      return Parent::edgeNum();
-    }
-
-  };
-
 }
 
 #endif

Modified: hugo/trunk/lemon/bits/graph_adaptor_extender.h
==============================================================================
--- hugo/trunk/lemon/bits/graph_adaptor_extender.h	(original)
+++ hugo/trunk/lemon/bits/graph_adaptor_extender.h	Fri May 12 11:51:45 2006
@@ -453,11 +453,6 @@
     typedef typename Parent::Edge Edge;
     typedef typename Parent::UEdge UEdge;
 
-    Node oppositeNode(const UEdge& edge, const Node& node) const {
-      return source(edge) == node ? 
-	target(edge) : source(edge);
-    }
-
 
     int maxId(Node) const {
       return Parent::maxNodeId();

Modified: hugo/trunk/lemon/bits/graph_extender.h
==============================================================================
--- hugo/trunk/lemon/bits/graph_extender.h	(original)
+++ hugo/trunk/lemon/bits/graph_extender.h	Fri May 12 11:51:45 2006
@@ -734,17 +734,193 @@
     typedef BpUGraphExtender Graph;
 
     typedef typename Parent::Node Node;
-    typedef typename Parent::BNode BNode;
-    typedef typename Parent::ANode ANode;
-    typedef typename Parent::Edge Edge;
     typedef typename Parent::UEdge UEdge;
 
+
+    using Parent::first;
+    using Parent::next;
+
+    using Parent::id;
+
+    class ANode : public Node {
+      friend class BpUGraphExtender;
+    public:
+      ANode() {}
+      ANode(const Node& node) : Node(node) {
+	LEMON_ASSERT(Parent::aNode(node) || node == INVALID, 
+		     typename Parent::NodeSetError());
+      }
+      ANode(Invalid) : Node(INVALID) {}
+    };
+
+    void first(ANode& node) const {
+      Parent::firstANode(static_cast<Node&>(node));
+    }
+    void next(ANode& node) const {
+      Parent::nextANode(static_cast<Node&>(node));
+    }
+
+    int id(const ANode& node) const {
+      return Parent::aNodeId(node);
+    }
+
+    class BNode : public Node {
+      friend class BpUGraphExtender;
+    public:
+      BNode() {}
+      BNode(const Node& node) : Node(node) {
+	LEMON_ASSERT(Parent::bNode(node) || node == INVALID,
+		     typename Parent::NodeSetError());
+      }
+      BNode(Invalid) : Node(INVALID) {}
+    };
+
+    void first(BNode& node) const {
+      Parent::firstBNode(static_cast<Node&>(node));
+    }
+    void next(BNode& node) const {
+      Parent::nextBNode(static_cast<Node&>(node));
+    }
+  
+    int id(const BNode& node) const {
+      return Parent::aNodeId(node);
+    }
+
+    Node source(const UEdge& edge) const {
+      return aNode(edge);
+    }
+    Node target(const UEdge& edge) const {
+      return bNode(edge);
+    }
+
+    void firstInc(UEdge& edge, bool& direction, const Node& node) const {
+      if (Parent::aNode(node)) {
+	Parent::firstFromANode(edge, node);
+	direction = true;
+      } else {
+	Parent::firstFromBNode(edge, node);
+	direction = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+    void nextInc(UEdge& edge, bool& direction) const {
+      if (direction) {
+	Parent::nextFromANode(edge);
+      } else {
+	Parent::nextFromBNode(edge);
+	if (edge == INVALID) direction = true;
+      }
+    }
+
+    class Edge : public UEdge {
+      friend class BpUGraphExtender;
+    protected:
+      bool forward;
+
+      Edge(const UEdge& edge, bool _forward)
+	: UEdge(edge), forward(_forward) {}
+
+    public:
+      Edge() {}
+      Edge (Invalid) : UEdge(INVALID), forward(true) {}
+      bool operator==(const Edge& i) const {
+	return UEdge::operator==(i) && forward == i.forward;
+      }
+      bool operator!=(const Edge& i) const {
+	return UEdge::operator!=(i) || forward != i.forward;
+      }
+      bool operator<(const Edge& i) const {
+	return UEdge::operator<(i) || 
+	  (!(i.forward<forward) && UEdge(*this)<UEdge(i));
+      }
+    };
+
+    void first(Edge& edge) const {
+      Parent::first(static_cast<UEdge&>(edge));
+      edge.forward = true;
+    }
+
+    void next(Edge& edge) const {
+      if (!edge.forward) {
+	Parent::next(static_cast<UEdge&>(edge));
+      }
+      edge.forward = !edge.forward;
+    }
+
+    void firstOut(Edge& edge, const Node& node) const {
+      if (Parent::aNode(node)) {
+	Parent::firstFromANode(edge, node);
+	edge.forward = true;
+      } else {
+	Parent::firstFromBNode(edge, node);
+	edge.forward = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+    void nextOut(Edge& edge) const {
+      if (edge.forward) {
+	Parent::nextFromANode(edge);
+      } else {
+	Parent::nextFromBNode(edge);
+        edge.forward = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+
+    void firstIn(Edge& edge, const Node& node) const {
+      if (Parent::bNode(node)) {
+	Parent::firstFromBNode(edge, node);
+	edge.forward = true;	
+      } else {
+	Parent::firstFromANode(edge, node);
+	edge.forward = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+    void nextIn(Edge& edge) const {
+      if (edge.forward) {
+	Parent::nextFromBNode(edge);
+      } else {
+	Parent::nextFromANode(edge);
+	edge.forward = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+
+    Node source(const Edge& edge) const {
+      return edge.forward ? Parent::aNode(edge) : Parent::bNode(edge);
+    }
+    Node target(const Edge& edge) const {
+      return edge.forward ? Parent::bNode(edge) : Parent::aNode(edge);
+    }
+
+    int id(const Edge& edge) const {
+      return (Parent::id(static_cast<const UEdge&>(edge)) << 1) + 
+        (edge.forward ? 0 : 1);
+    }
+    Edge edgeFromId(int id) const {
+      return Edge(Parent::fromUEdgeId(id >> 1), (id & 1) == 0);
+    }
+    int maxEdgeId() const {
+      return (Parent::maxUEdgeId(UEdge()) << 1) + 1;
+    }
+
+    bool direction(const Edge& edge) const {
+      return edge.forward;
+    }
+
+    Edge direct(const UEdge& edge, bool direction) const {
+      return Edge(edge, direction);
+    }
+
+    int edgeNum() const {
+      return 2 * Parent::uEdgeNum();
+    }
+
+    int uEdgeNum() const {
+      return Parent::uEdgeNum();
+    }
+
     Node oppositeNode(const UEdge& edge, const Node& node) const {
       return source(edge) == node ? 
 	target(edge) : source(edge);
     }
 
-    using Parent::direct;
     Edge direct(const UEdge& edge, const Node& node) const {
       return Edge(edge, node == Parent::source(edge));
     }
@@ -764,7 +940,7 @@
       return Parent::maxANodeId();
     }
     int maxId(Edge) const {
-      return Parent::maxEdgeId();
+      return maxEdgeId();
     }
     int maxId(UEdge) const {
       return Parent::maxUEdgeId();

Modified: hugo/trunk/lemon/edge_set.h
==============================================================================
--- hugo/trunk/lemon/edge_set.h	(original)
+++ hugo/trunk/lemon/edge_set.h	Fri May 12 11:51:45 2006
@@ -337,11 +337,11 @@
   /// \ref concept::ErasableUGraph "ErasableUGraph" concept.
   template <typename _Graph>
   class ListUEdgeSet 
-    : public UEdgeSetExtender<UGraphBaseExtender<ListEdgeSetBase<_Graph> > > {
+    : public UEdgeSetExtender<UndirGraphExtender<ListEdgeSetBase<_Graph> > > {
 
   public:
 
-    typedef UEdgeSetExtender<UGraphBaseExtender<
+    typedef UEdgeSetExtender<UndirGraphExtender<
       ListEdgeSetBase<_Graph> > > Parent;
     
     typedef typename Parent::Node Node;
@@ -669,11 +669,11 @@
   /// \ref concept::ExtendableUGraph "ExtendableUGraph" concept.
   template <typename _Graph>
   class SmartUEdgeSet 
-    : public UEdgeSetExtender<UGraphBaseExtender<SmartEdgeSetBase<_Graph> > > {
+    : public UEdgeSetExtender<UndirGraphExtender<SmartEdgeSetBase<_Graph> > > {
 
   public:
 
-    typedef UEdgeSetExtender<UGraphBaseExtender<
+    typedef UEdgeSetExtender<UndirGraphExtender<
       SmartEdgeSetBase<_Graph> > > Parent;
     
     typedef typename Parent::Node Node;

Modified: hugo/trunk/lemon/full_graph.h
==============================================================================
--- hugo/trunk/lemon/full_graph.h	(original)
+++ hugo/trunk/lemon/full_graph.h	Fri May 12 11:51:45 2006
@@ -441,7 +441,7 @@
 
   };
 
-  typedef UGraphExtender<UGraphBaseExtender<FullUGraphBase> > 
+  typedef UGraphExtender<UndirGraphExtender<FullUGraphBase> > 
   ExtendedFullUGraphBase;
 
   /// \ingroup graphs
@@ -518,18 +518,18 @@
       bool operator<(const Node i) const {return id<i.id;}
     };
 
-    class Edge {
+    class UEdge {
       friend class FullBpUGraphBase;
     protected:
       int id;
 
-      Edge(int _id) { id = _id;}
+      UEdge(int _id) { id = _id;}
     public:
-      Edge() {}
-      Edge (Invalid) { id = -1; }
-      bool operator==(const Edge i) const {return id==i.id;}
-      bool operator!=(const Edge i) const {return id!=i.id;}
-      bool operator<(const Edge i) const {return id<i.id;}
+      UEdge() {}
+      UEdge (Invalid) { id = -1; }
+      bool operator==(const UEdge i) const {return id==i.id;}
+      bool operator!=(const UEdge i) const {return id!=i.id;}
+      bool operator<(const UEdge i) const {return id<i.id;}
     };
 
     void construct(int aNodeNum, int bNodeNum) {
@@ -568,27 +568,27 @@
       }
     }
   
-    void first(Edge& edge) const {
+    void first(UEdge& edge) const {
       edge.id = _edgeNum - 1;
     }
-    void next(Edge& edge) const {
+    void next(UEdge& edge) const {
       --edge.id;
     }
 
-    void firstOut(Edge& edge, const Node& node) const {
+    void firstFromANode(UEdge& edge, const Node& node) const {
       LEMON_ASSERT((node.id & 1) == 0, NodeSetError());
       edge.id = (node.id >> 1) * _bNodeNum;
     }
-    void nextOut(Edge& edge) const {
+    void nextFromANode(UEdge& edge) const {
       ++(edge.id);
       if (edge.id % _bNodeNum == 0) edge.id = -1;
     }
 
-    void firstIn(Edge& edge, const Node& node) const {
+    void firstFromBNode(UEdge& edge, const Node& node) const {
       LEMON_ASSERT((node.id & 1) == 1, NodeSetError());
       edge.id = (node.id >> 1);
     }
-    void nextIn(Edge& edge) const {
+    void nextFromBNode(UEdge& edge) const {
       edge.id += _bNodeNum;
       if (edge.id >= _edgeNum) edge.id = -1;
     }
@@ -604,13 +604,13 @@
 	_aNodeNum * 2 - 2 : _bNodeNum * 2 - 1;
     }
   
-    static int id(const Edge& edge) {
+    static int id(const UEdge& edge) {
       return edge.id;
     }
-    static Edge edgeFromId(int id) {
-      return Edge(id);
+    static UEdge uEdgeFromId(int id) {
+      return UEdge(id);
     }
-    int maxEdgeId() const {
+    int maxUEdgeId() const {
       return _edgeNum - 1;
     }
   
@@ -634,10 +634,10 @@
       return _bNodeNum;
     }
 
-    Node aNode(const Edge& edge) const {
+    Node aNode(const UEdge& edge) const {
       return Node((edge.id / _bNodeNum) << 1);
     }
-    Node bNode(const Edge& edge) const {
+    Node bNode(const UEdge& edge) const {
       return Node(((edge.id % _bNodeNum) << 1) + 1);
     }
 
@@ -663,13 +663,12 @@
     int bNodeNum() const { return _bNodeNum; }
 
     typedef True EdgeNumTag;
-    int edgeNum() const { return _edgeNum; }
+    int uEdgeNum() const { return _edgeNum; }
 
   };
 
 
-  typedef BpUGraphExtender< BpUGraphBaseExtender<
-    FullBpUGraphBase> > ExtendedFullBpUGraphBase;
+  typedef BpUGraphExtender<FullBpUGraphBase> ExtendedFullBpUGraphBase;
 
 
   /// \ingroup graphs

Modified: hugo/trunk/lemon/grid_ugraph.h
==============================================================================
--- hugo/trunk/lemon/grid_ugraph.h	(original)
+++ hugo/trunk/lemon/grid_ugraph.h	Fri May 12 11:51:45 2006
@@ -347,8 +347,8 @@
   };
 
 
-  typedef UGraphExtender<UGraphBaseExtender<
-    GridUGraphBase> > ExtendedGridUGraphBase;
+  typedef UGraphExtender<UndirGraphExtender<GridUGraphBase> > 
+  ExtendedGridUGraphBase;
 
   /// \ingroup graphs
   ///

Modified: hugo/trunk/lemon/list_graph.h
==============================================================================
--- hugo/trunk/lemon/list_graph.h	(original)
+++ hugo/trunk/lemon/list_graph.h	Fri May 12 11:51:45 2006
@@ -566,8 +566,8 @@
 
   /**************** Undirected List Graph ****************/
 
-  typedef UGraphExtender<UGraphBaseExtender<
-    ListGraphBase> > ExtendedListUGraphBase;
+  typedef UGraphExtender<UndirGraphExtender<ListGraphBase> > 
+  ExtendedListUGraphBase;
 
   /// \addtogroup graphs
   /// @{
@@ -651,7 +651,7 @@
       int first_edge, next_node;
     };
 
-    struct EdgeT {
+    struct UEdgeT {
       int aNode, prev_out, next_out;
       int bNode, prev_in, next_in;
     };
@@ -659,7 +659,7 @@
     std::vector<NodeT> aNodes;
     std::vector<NodeT> bNodes;
 
-    std::vector<EdgeT> edges;
+    std::vector<UEdgeT> edges;
 
     int first_anode;
     int first_free_anode;
@@ -685,18 +685,18 @@
       bool operator<(const Node i) const {return id<i.id;}
     };
 
-    class Edge {
+    class UEdge {
       friend class ListBpUGraphBase;
     protected:
       int id;
 
-      explicit Edge(int _id) { id = _id;}
+      explicit UEdge(int _id) { id = _id;}
     public:
-      Edge() {}
-      Edge (Invalid) { id = -1; }
-      bool operator==(const Edge i) const {return id==i.id;}
-      bool operator!=(const Edge i) const {return id!=i.id;}
-      bool operator<(const Edge i) const {return id<i.id;}
+      UEdge() {}
+      UEdge (Invalid) { id = -1; }
+      bool operator==(const UEdge i) const {return id==i.id;}
+      bool operator!=(const UEdge i) const {return id!=i.id;}
+      bool operator<(const UEdge i) const {return id<i.id;}
     };
 
     ListBpUGraphBase()
@@ -740,7 +740,7 @@
       }
     }
   
-    void first(Edge& edge) const {
+    void first(UEdge& edge) const {
       int aNodeId = first_anode;
       while (aNodeId != -1 && aNodes[aNodeId].first_edge == -1) {
         aNodeId = aNodes[aNodeId].next_node != -1 ? 
@@ -752,7 +752,7 @@
         edge.id = -1;
       }
     }
-    void next(Edge& edge) const {
+    void next(UEdge& edge) const {
       int aNodeId = edges[edge.id].aNode >> 1;
       edge.id = edges[edge.id].next_out;
       if (edge.id == -1) {
@@ -770,19 +770,19 @@
       }
     }
 
-    void firstOut(Edge& edge, const Node& node) const {
+    void firstFromANode(UEdge& edge, const Node& node) const {
       LEMON_ASSERT((node.id & 1) == 0, NodeSetError());
       edge.id = aNodes[node.id >> 1].first_edge;
     }
-    void nextOut(Edge& edge) const {
+    void nextFromANode(UEdge& edge) const {
       edge.id = edges[edge.id].next_out;
     }
 
-    void firstIn(Edge& edge, const Node& node) const {
+    void firstFromBNode(UEdge& edge, const Node& node) const {
       LEMON_ASSERT((node.id & 1) == 1, NodeSetError());
       edge.id = bNodes[node.id >> 1].first_edge;
     }
-    void nextIn(Edge& edge) const {
+    void nextFromBNode(UEdge& edge) const {
       edge.id = edges[edge.id].next_in;
     }
 
@@ -797,13 +797,13 @@
 	aNodes.size() * 2 - 2 : bNodes.size() * 2 - 1;
     }
   
-    static int id(const Edge& edge) {
+    static int id(const UEdge& edge) {
       return edge.id;
     }
-    static Edge edgeFromId(int id) {
-      return Edge(id);
+    static UEdge uEdgeFromId(int id) {
+      return UEdge(id);
     }
-    int maxEdgeId() const {
+    int maxUEdgeId() const {
       return edges.size();
     }
   
@@ -827,10 +827,10 @@
       return bNodes.size();
     }
 
-    Node aNode(const Edge& edge) const {
+    Node aNode(const UEdge& edge) const {
       return Node(edges[edge.id].aNode);
     }
-    Node bNode(const Edge& edge) const {
+    Node bNode(const UEdge& edge) const {
       return Node(edges[edge.id].bNode);
     }
 
@@ -874,7 +874,7 @@
       return Node((bNodeId << 1) + 1);
     }
 
-    Edge addEdge(const Node& source, const Node& target) {
+    UEdge addEdge(const Node& source, const Node& target) {
       LEMON_ASSERT(((source.id ^ target.id) & 1) == 1, NodeSetError());
       int edgeId;
       if (first_free_edge != -1) {
@@ -882,7 +882,7 @@
         first_free_edge = edges[edgeId].next_out;
       } else {
         edgeId = edges.size();
-        edges.push_back(EdgeT());
+        edges.push_back(UEdgeT());
       }
       if ((source.id & 1) == 0) {
 	edges[edgeId].aNode = source.id;
@@ -903,7 +903,7 @@
         edges[bNodes[edges[edgeId].bNode >> 1].first_edge].prev_in = edgeId;
       }
       bNodes[edges[edgeId].bNode >> 1].first_edge = edgeId;
-      return Edge(edgeId);
+      return UEdge(edgeId);
     }
 
     void erase(const Node& node) {
@@ -918,7 +918,7 @@
       }
     }
 
-    void erase(const Edge& edge) {
+    void erase(const UEdge& edge) {
       if (edges[edge.id].prev_out != -1) {
         edges[edges[edge.id].prev_out].next_out = edges[edge.id].next_out;
       } else {
@@ -953,8 +953,7 @@
   };
 
 
-  typedef BpUGraphExtender< BpUGraphBaseExtender<
-    ListBpUGraphBase> > ExtendedListBpUGraphBase;
+  typedef BpUGraphExtender< ListBpUGraphBase > ExtendedListBpUGraphBase;
 
   /// \ingroup graphs
   ///

Modified: hugo/trunk/lemon/smart_graph.h
==============================================================================
--- hugo/trunk/lemon/smart_graph.h	(original)
+++ hugo/trunk/lemon/smart_graph.h	Fri May 12 11:51:45 2006
@@ -119,8 +119,16 @@
     ///\return The ID of the edge \c e. 
     static int id(Edge e) { return e.n; }
 
+    /// \brief Returns the node from its \c id.
+    ///
+    /// Returns the node from its \c id. If there is not node
+    /// with the given id the effect of the function is undefinied.
     static Node nodeFromId(int id) { return Node(id);}
 
+    /// \brief Returns the edge from its \c id.
+    ///
+    /// Returns the edge from its \c id. If there is not edge
+    /// with the given id the effect of the function is undefinied.
     static Edge edgeFromId(int id) { return Edge(id);}
 
     Node addNode() {
@@ -350,7 +358,7 @@
 
   /**************** Undirected List Graph ****************/
 
-  typedef UGraphExtender<UGraphBaseExtender<SmartGraphBase> >
+  typedef UGraphExtender<UndirGraphExtender<SmartGraphBase> >
   ExtendedSmartUGraphBase;
 
   /// \ingroup graphs
@@ -388,7 +396,7 @@
       NodeT(int _first) : first(_first) {}
     };
 
-    struct EdgeT {
+    struct UEdgeT {
       int aNode, next_out;
       int bNode, next_in;
     };
@@ -396,7 +404,7 @@
     std::vector<NodeT> aNodes;
     std::vector<NodeT> bNodes;
 
-    std::vector<EdgeT> edges;
+    std::vector<UEdgeT> edges;
 
   public:
   
@@ -414,18 +422,18 @@
       bool operator<(const Node i) const {return id<i.id;}
     };
 
-    class Edge {
+    class UEdge {
       friend class SmartBpUGraphBase;
     protected:
       int id;
 
-      Edge(int _id) { id = _id;}
+      UEdge(int _id) { id = _id;}
     public:
-      Edge() {}
-      Edge (Invalid) { id = -1; }
-      bool operator==(const Edge i) const {return id==i.id;}
-      bool operator!=(const Edge i) const {return id!=i.id;}
-      bool operator<(const Edge i) const {return id<i.id;}
+      UEdge() {}
+      UEdge (Invalid) { id = -1; }
+      bool operator==(const UEdge i) const {return id==i.id;}
+      bool operator!=(const UEdge i) const {return id!=i.id;}
+      bool operator<(const UEdge i) const {return id<i.id;}
     };
 
     void firstANode(Node& node) const {
@@ -458,26 +466,26 @@
       }
     }
   
-    void first(Edge& edge) const {
+    void first(UEdge& edge) const {
       edge.id = edges.size() - 1;
     }
-    void next(Edge& edge) const {
+    void next(UEdge& edge) const {
       --edge.id;
     }
 
-    void firstOut(Edge& edge, const Node& node) const {
+    void firstFromANode(UEdge& edge, const Node& node) const {
       LEMON_ASSERT((node.id & 1) == 0, NodeSetError());
       edge.id = aNodes[node.id >> 1].first;
     }
-    void nextOut(Edge& edge) const {
+    void nextFromANode(UEdge& edge) const {
       edge.id = edges[edge.id].next_out;
     }
 
-    void firstIn(Edge& edge, const Node& node) const {
+    void firstFromBNode(UEdge& edge, const Node& node) const {
       LEMON_ASSERT((node.id & 1) == 1, NodeSetError());
       edge.id = bNodes[node.id >> 1].first;
     }
-    void nextIn(Edge& edge) const {
+    void nextFromBNode(UEdge& edge) const {
       edge.id = edges[edge.id].next_in;
     }
 
@@ -492,13 +500,13 @@
 	aNodes.size() * 2 - 2 : bNodes.size() * 2 - 1;
     }
   
-    static int id(const Edge& edge) {
+    static int id(const UEdge& edge) {
       return edge.id;
     }
-    static Edge edgeFromId(int id) {
-      return Edge(id);
+    static UEdge uEdgeFromId(int id) {
+      return UEdge(id);
     }
-    int maxEdgeId() const {
+    int maxUEdgeId() const {
       return edges.size();
     }
   
@@ -522,10 +530,10 @@
       return bNodes.size();
     }
 
-    Node aNode(const Edge& edge) const {
+    Node aNode(const UEdge& edge) const {
       return Node(edges[edge.id].aNode);
     }
-    Node bNode(const Edge& edge) const {
+    Node bNode(const UEdge& edge) const {
       return Node(edges[edge.id].bNode);
     }
 
@@ -551,9 +559,9 @@
       return Node(bNodes.size() * 2 - 1);
     }
 
-    Edge addEdge(const Node& source, const Node& target) {
+    UEdge addEdge(const Node& source, const Node& target) {
       LEMON_ASSERT(((source.id ^ target.id) & 1) == 1, NodeSetError());
-      EdgeT edgeT;
+      UEdgeT edgeT;
       if ((source.id & 1) == 0) {
 	edgeT.aNode = source.id;
 	edgeT.bNode = target.id;
@@ -566,7 +574,7 @@
       edgeT.next_in = bNodes[edgeT.bNode >> 1].first;
       bNodes[edgeT.bNode >> 1].first = edges.size();
       edges.push_back(edgeT);
-      return Edge(edges.size() - 1);
+      return UEdge(edges.size() - 1);
     }
 
     void clear() {
@@ -581,13 +589,12 @@
     int bNodeNum() const { return bNodes.size(); }
 
     typedef True EdgeNumTag;
-    int edgeNum() const { return edges.size(); }
+    int uEdgeNum() const { return edges.size(); }
 
   };
 
 
-  typedef BpUGraphExtender< BpUGraphBaseExtender<
-    SmartBpUGraphBase> > ExtendedSmartBpUGraphBase;
+  typedef BpUGraphExtender<SmartBpUGraphBase> ExtendedSmartBpUGraphBase;
 
   /// \ingroup graphs
   ///



More information about the Lemon-commits mailing list